Django和Python + uWSGI

使用指令我尝试连接Python + uWSGI

我在/ home / sanya / django / pasteurl文件夹中创build了默认项目。 但是,我已经打开了浏览器

uWSGI Error wsgi application not found 

日志包含以下内容:

 binding on TCP port: 9001 your server socket listen backlog is limited to 64 connections added /home/sanya/django/pasteurl to pythonpath. initializing hooks...done. ...getting the applications list from the 'django' module... uwsgi.applications dictionary is not defined, trying with the "applications" one... applications dictionary is not defined, trying with the "application" callable. static applications not defined, you have to use the dynamic one... spawned uWSGI master process (pid: 7637) spawned uWSGI worker 1 (pid: 7646) spawned uWSGI worker 2 (pid: 7647) spawned uWSGI worker 3 (pid: 7648) spawned uWSGI worker 4 (pid: 7649) 

文件/home/sanya/django/pasteurl/django.wsgi

 import os import django.core.handlers.wsgi # init django settings os.environ['DJANGO_SETTINGS_MODULE'] = 'pasteurl.settings' # define wsgi app application = django.core.handlers.wsgi.WSGIHandler() # mount this application at the webroot # applications = { '/': 'application' } 

正如我意识到的,这个应用程序字典有问题

FWIW,从1997年开始,查看源代码 ,我们看到,如果uWSGI找不到applications字典,它将发出您正在接收的错误消息的确切顺序。

看着你的django.wsgi文件,我们看到这行,

 `applications = {'/': 'application'} 

被注释掉了。 我想知道我们可以做些什么;)

顺便说一句,我发现使用谷歌的源代码。 用引号搜索错误信息通常是一件好事。 点击链接后,我发现自己很幸运能直接从谷歌(发生越来越多)发现源代码,我按Ctrl-F进行“在页面上查找”,并在浏览器中重新输入错误消息在页面搜索设施,导致我直接到相关的线路。

同样的问题,在这里说:

 uWSGI Error wsgi application not found 

检查nginx conf:

 uwsgi_param UWSGI_CHDIR somepath wsgi_param UWSGI_SCRIPT somefile 

确保:

1.sompath / somefile.py必须存在

2.必须使用“.py”作为扩展名文件名

3.不要使用“somefile.py”等全名,或者出现相同的错误ocer,并在uwsgi日志文件中有错误日志:

 ImportError: No module named py