Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
uWSGI&x2B;Django+;Python:没有名为uwsgi的模块_Python_Django_Uwsgi - Fatal编程技术网

uWSGI&x2B;Django+;Python:没有名为uwsgi的模块

uWSGI&x2B;Django+;Python:没有名为uwsgi的模块,python,django,uwsgi,Python,Django,Uwsgi,我正在为我的Django项目设置uwsgi。 它可以和你一起跑 ./manage.py runserver 0.0.0.0:9010 但是当我尝试的时候 uwsgi --http :9010 --chdir /home/user/appname --module wsgi --wsgi-file /home/user/appname/appname/wsgi.py 我明白了 ImportError: No module named wsgi 我做错了什么 以下是完整日志: uWSGI

我正在为我的Django项目设置uwsgi。 它可以和你一起跑

./manage.py runserver 0.0.0.0:9010
但是当我尝试的时候

 uwsgi --http :9010 --chdir /home/user/appname --module wsgi --wsgi-file /home/user/appname/appname/wsgi.py 
我明白了

ImportError: No module named wsgi
我做错了什么

以下是完整日志:

uWSGI http bound on :9010 fd 4
spawned uWSGI http 1 (pid: 1900)
uwsgi socket 0 bound to TCP address 127.0.0.1:42684 (port auto-assigned) fd 3
Python version: 2.7.9 (default, Mar  1 2015, 13:01:26)  [GCC 4.9.2]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x1c17310
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72760 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
ImportError: No module named wsgi
unable to load app 0 (mountpoint='') (callable not found or import error)
Traceback (most recent call last):
  File "/home/robert/surmaroute/surmaroute/wsgi.py", line 13, in <module>
    from django.core.wsgi import get_wsgi_application
ImportError: No module named django.core.wsgi
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 1899, cores: 1)
uWSGI http绑定于:9010 fd 4
衍生的uWSGI http 1(pid:1900)
uwsgi套接字0绑定到TCP地址127.0.0.1:42684(端口自动分配)fd 3
Python版本:2.7.9(默认值,2015年3月1日,13:01:26)[GCC 4.9.2]
***Python线程支持已禁用。您可以使用--enable threads来启用它***
Python主解释器在0x1c17310处初始化
您的服务器套接字侦听积压限制为100个连接
你对工人的仁慈是60秒
为1个核心映射72760字节(71 KB)
***操作模式:单流程***
ImportError:没有名为wsgi的模块
无法加载应用0(装入点=“”)(找不到可调用或导入错误)
回溯(最近一次呼叫最后一次):
文件“/home/robert/surmaroute/surmaroute/wsgi.py”,第13行,在
从django.core.wsgi导入获取\u wsgi\u应用程序
ImportError:没有名为django.core.wsgi的模块
无法加载应用0(装入点=“”)(找不到可调用或导入错误)
***没有加载应用程序。以全动态模式运行***
***uWSGI以多解释器模式运行***
产生了uWSGI工作者1(也是唯一的)(pid:1899,cores:1)

问题在于您的应用程序没有名为
uwsgi的模块。您将目录更改为
/home/user/appname
,但实际的模块似乎是
appname.uwsgi
,因为
uwsgi.py
文件位于
/home/user/appname/appname/uwsgi.py

通常,您不需要同时指定
--wsgi文件
--module
,因此我可以这样做

uwsgi --http :9010 --chdir /home/user/appname --wsgi-file /home/user/appname/appname/wsgi.py


我个人更喜欢第二个。

这是一个问题,因为显然你的应用程序没有模块
wsgi
。这是uwsgi试图导入以查找您的应用程序的模块。基于上述结构,您可能需要类似于
--module appname.wsgi
的内容,但您甚至可能不需要它,因为您已经指定了
--wsgi文件
uwsgi --http :9010 --chdir /home/user/appname --module appname.uwsgi