Skip to content

Commit 79cf96b

Browse files
author
hustcc
committed
fixed monkey_patch for celery
1 parent ee3019e commit 79cf96b

File tree

5 files changed

+10
-5
lines changed

5 files changed

+10
-5
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@
4646

4747
```sh
4848
# 1. run python web
49-
python run_webhook.py
49+
python manage.py runserver
5050
# 2. run celery
51-
celery -A app.celeryInstance worker --loglevel=info
51+
python manage.py celery
5252
```
5353

5454
运行之后,打开 http://127.0.0.1:18340 (一巴扇死你)即可访问。使用 GitHub 账号登陆。

app/__init__.py

-3
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,11 @@
1111
from celery import Celery, platforms
1212
from app.utils.validator import Validator
1313
from flask_socketio import SocketIO
14-
import eventlet
1514

1615

1716
# 版本号
1817
__version__ = '0.0.4'
1918

20-
# monkey_patch
21-
eventlet.monkey_patch()
2219

2320
# flask
2421
app = Flask(__name__)

manage.py

+4
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ def __call__(self, app, host, port, use_debugger, use_reloader):
6262
use_debugger = True
6363
if use_reloader is None:
6464
use_reloader = app.debug
65+
import eventlet
66+
# monkey_patch
67+
eventlet.monkey_patch()
68+
6569
socketio.run(app,
6670
host=host,
6771
port=port,

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ timeago==1.0.6
1212
schema==0.6.5
1313
validators==0.11.0
1414
flask-socketio==2.7.2
15+
Flask-Script==2.0.5

run_webhook.py

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88

99
from app import app, socketio
10+
import eventlet
11+
# monkey_patch
12+
eventlet.monkey_patch()
1013

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

0 commit comments

Comments
 (0)