我正在尝试按照本指南中的步骤操作:http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html
在我进入nginx部分之前,我正在尝试确保uWSGI正常工作
我的文件夹结构是srv/www/domain/projectdatabank /
项目数据库文件夹包含我的manage.py文件
我的wsgi.py文件如下所示:
import os
import sys
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
Run Code Online (Sandbox Code Playgroud)
你需要看看我的settings.py吗?
当我指向浏览器时,我收到以下错误:
-- no python application found, check your startup logs for errors ---
[pid: 10165|app: -1|req: -1/1] 66.56.35.151 () {38 vars in 681 bytes} [Tue Jul 9 18:19:46 2013] GET /admin/ => generated 21 bytes in 0 msecs (HTTP/1.1 500) 1 headers in 57 bytes (0 switches on core 0)
--- no python application found, check your startup logs for errors ---
[pid: 10165|app: -1|req: -1/2] 66.56.35.151 () {36 vars in 638 bytes} [Tue Jul 9 18:19:49 2013] GET / => generated 21 bytes in 0 msecs (HTTP/1.1 500) 1 headers in 57 bytes (0 switches on core 0)
现在,当我检查我的uWGI日志时,它与上面的相同.
tar*_*req 48
我解决了这个问题
在我的原始命令行中没有包含运行uWSGI的wsgi.py文件的完整路径
uwsgi --http :8000 --chdir /srv/www/databankinfo.com/projectdatabank/ --wsgi-file wsgi.py
Run Code Online (Sandbox Code Playgroud)
对此
uwsgi --http :8000 --chdir /srv/www/databankinfo.com/projectdatabank/ --wsgi-file full/path/wsgi.py
Run Code Online (Sandbox Code Playgroud)
它起作用了
Fra*_*ris 43
对于调试同样错误的其他人,还有另一种可能性:您的异常被抛出uwsgi.py.要对此进行测试,请直接在应用程序中打开django shell python manage.py shell并导入uwsgi.py(使用与您相同的路径uwsgi.ini).
roo*_*web 13
查看关于在uwsgi http://blog.johannesklug.de/2012/11/27/deploying-django-behind-nginx-with-uwsgi-and-virtualenv/后面部署Django的博文.我创建了一个ini-File来设置uwsgi,它指向可以使用参数调用的app module=project.wsgi:application.
整个文件的内容如下:
(env)[project@host ~]$ cat uwsgi.ini
[uwsgi]
# path to where you put your project code
chdir=/home/project/project
# python path to the wsgi module, check if you have one
module=project.wsgi:application
# this switch tells uwsgi to spawn a master process,
# that will dynamically spawn new child processes for
# server requests
master=True
# uwsgi stores the pid of your master process here
pidfile=/home/project/master.pid
vacuum=True
# path to your virtual environment
home=/home/project/env/
# path to log file
daemonize=/home/project/log
# this is where you need to point nginx to,
# if you chose to put this in project home make
# sure the home dir is readable and executable by
# nginx
socket=/tmp/uwsgi.sock
### SEE UPDATE NOTICE FOR THIS ONE
env = DJANGO_SETTINGS_MODULE=project.settings
Run Code Online (Sandbox Code Playgroud)
请注意,我正在使用virtualenv.
你可能也会错过这些台词
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")
Run Code Online (Sandbox Code Playgroud)
在你的wsgi.py中
| 归档时间: |
|
| 查看次数: |
73695 次 |
| 最近记录: |