簡體   English   中英

uWSGI + Django + Python:沒有名為uwsgi的模塊

[英]uWSGI + Django + Python: no module named 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的模塊。 您將目錄更改為/home/user/appname但實際模塊看起來像是appname.uwsgi因為uwsgi.py文件位於/home/user/appname/appname/uwsgi.py

通常,您不需要同時指定--wsgi-file--module所以我會這樣做

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

要么

uwsgi --http :9010 --chdir /home/user/appname --module appname.uwsgi

我個人更喜歡第二個。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM