7

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

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

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' }

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

4

2 回答 2

1

同样的问题,在这里备注:

uWSGI Error
wsgi application not found

检查 nginx 配置文件:

uwsgi_param UWSGI_CHDIR  somepath
wsgi_param UWSGI_SCRIPT  somefile

确保:

1.sompath/somefile.py 必须存在

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

3.不要使用全名,如“somefile.py”,或同样的错误发生,并且在uwsgi日志文件中有错误日志:

ImportError: No module named py
于 2011-08-03T05:50:53.430 回答
1

FWIW,查看源代码,从第 1997 行开始,我们看到 uWSGI 在找不到applications字典时会发出您收到的错误消息的确切序列。

查看您的django.wsgi文件,我们看到这一行,

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

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

顺便说一句,我使用google找到了源代码。谷歌搜索引号中的错误消息通常是一件好事。单击该链接并意识到我很幸运能够直接从谷歌找到源代码(越来越多)后,我按下 Ctrl-F 以“在页面上查找”并在我的浏览器中重新输入错误消息在页面搜索工具上,它使我直接进入相关行。

于 2010-09-23T06:27:39.220 回答