Skip to content

Commit

Permalink
fixed monkey_patch for celery
Browse files Browse the repository at this point in the history
  • Loading branch information
hustcc committed Nov 30, 2016
1 parent ee3019e commit 79cf96b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@

```sh
# 1. run python web
python run_webhook.py
python manage.py runserver
# 2. run celery
celery -A app.celeryInstance worker --loglevel=info
python manage.py celery
```

运行之后,打开 http://127.0.0.1:18340 (一巴扇死你)即可访问。使用 GitHub 账号登陆。
Expand Down
3 changes: 0 additions & 3 deletions app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,11 @@
from celery import Celery, platforms
from app.utils.validator import Validator
from flask_socketio import SocketIO
import eventlet


# 版本号
__version__ = '0.0.4'

# monkey_patch
eventlet.monkey_patch()

# flask
app = Flask(__name__)
Expand Down
4 changes: 4 additions & 0 deletions manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ def __call__(self, app, host, port, use_debugger, use_reloader):
use_debugger = True
if use_reloader is None:
use_reloader = app.debug
import eventlet
# monkey_patch
eventlet.monkey_patch()

socketio.run(app,
host=host,
port=port,
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ timeago==1.0.6
schema==0.6.5
validators==0.11.0
flask-socketio==2.7.2
Flask-Script==2.0.5
3 changes: 3 additions & 0 deletions run_webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@


from app import app, socketio
import eventlet
# monkey_patch
eventlet.monkey_patch()

if __name__ == '__main__':
socketio.run(app, host='0.0.0.0', port=18340)

0 comments on commit 79cf96b

Please sign in to comment.