flasky-with-celery

How to incorporate Celery into a well structured Flask application

  • 所有者: miguelgrinberg/flasky-with-celery
  • 平台:
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

Flasky with Celery

This repository contains a version of the Flasky application featured in my O'Reilly book Flask Web Development that demonstrates how to run Celery.

The application is largely the same as in the book. The only change is that the sending of emails is handled by a Celery task instead of a background thread. You can look at this commit to see exactly what changes were made.

Quick Setup

  1. Clone this repository.
  2. Create a virtualenv and install the requirements (pip install requirements/dev.txt)
  3. Run the database migrations (python manage.py db upgrade)
  4. Open a second terminal window and start a local Redis server (if you are on Linux or Mac, execute run-redis.sh to install and launch a private copy).
  5. Open a third terminal window. Set two environment variables MAIL_USERNAME and MAIL_PASSWORD to a valid Gmail account credentials (these will be used to send emails through Gmail's SMTP server). Then start a Celery worker: venv/bin/celery worker -A celery_worker.celery --loglevel=info.
  6. Start Flasky on your first terminal window: venv/bin/python manage.py runserver.
  7. Go to http://localhost:5000/ and register an account to see how the Celery background emails work!

For general details on how to integrate Celery with Flask, see my article Using Celery with Flask.

主要指標

概覽
名稱與所有者miguelgrinberg/flasky-with-celery
主編程語言Python
編程語言Python (語言數: 5)
平台
許可證MIT License
所有者活动
創建於2015-05-14 23:57:32
推送於2023-01-03 11:25:20
最后一次提交2016-06-01 10:45:26
發布數0
用户参与
星數284
關注者數9
派生數74
提交數8
已啟用問題?
問題數13
打開的問題數0
拉請求數1
打開的拉請求數0
關閉的拉請求數16
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?