配置nginx.conf
vim nginx.conf location / { root /www/fabric-bolt/lib/python2.7/site-packages/fabric_bolt; include uwsgi_params; uwsgi_pass 192.168.1.121:9001; uwsgi_param UWSGI_CHDIR /www/fabric-bolt/lib/python2.7/site-packages/fabric_bolt; uwsgi_param UWSGI_SCRIPT wsgi; access_log /usr/local/nginx/logs/access.log; } location /static/ { alias /www/fabric-bolt/lib/python2.7/site-packages/fabric_bolt/work/myweb/static/; index index.html; }
配置wsgi.xml:
vim uwsgi.xml
<uwsgi> <socket>192.168.1.121:9001</socket> <pidfile>/usr/local/nginx/conf/uwsgi.pid</pidfile> <processes>2</processes> <pythonpath>/www/fabric-bolt/lib/python2.7/site-packages</pythonpath> <pythonpath>/www/fabric-bolt/lib/python2.7/site-packages/fabric_bolt</pythonpath> <module>wsgi</module> <chdir>/www/fabric-bolt/lib/python2.7/site-packages/fabric_bolt</chdir> <daemonize>/tmp/uwsgi.log</daemonize> </uwsgi>
这样nginx+uwsgi部署fabric-bolt的时候/tmp/uwsgi.log报错:
1.
File "/www/fabric-bolt/lib/python2.7/site-packages/django/conf/__init__.py", line 151, in __init__ raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.") django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.
解决方法:fabric_bolt/wsgi.py
"core.settings"修改为""core.settings.settings"
2.
File "/www/fabric-bolt/lib/python2.7/site-packages/fabric_bolt/core/urls.py", line 4, in <module> import socketio.sdjango django.core.exceptions.ImproperlyConfigured: Error importing module stronghold.middleware: "No module named socketio.sdjango
解决方法:
vim /www/fabric-bolt/lib/python2.7/site-packages/fabric_bolt/core/urls.py
注释掉socketio相关几行
3.
File "/www/fabric-bolt/lib/python2.7/site-packages/fabric_bolt/web_hooks/receivers.py", line 5, in <module> from fabric_bolt.projects.models import Deployment django.core.exceptions.ImproperlyConfigured: Error importing module stronghold.middleware: "cannot import name Deployment"
解决方法:
vim core/settings/base.py
注释掉‘fabric_bolt.web_hooks‘,
这是可以访问通过nginx访问到fabric-bolt主页了:
时间: 2024-11-05 23:25:37