我正在设置djano和uwsgi
$uwsgi --ini uwsgi.ini
我的Django根目录在这里 /var/www/html/myapp/current
它必须是非常简单的设置,但是我不确定。
我有这两个文件
/var/www/html/myapp/current/myapp/settings.py
/var/www/html/myapp/current/myapp/wsgi.py
[uwsgi]
chdir=/var/www/html/myapp/current #it success
module=myapp.wsgi:application #it success
env DJANGO_SETTINGS_MODULE=myapp.settings # it success
http-socket = 0.0.0.0:8008
processes = 1
threasds = 1
master = 1
max-requests = 100000
错误在下面,但我无法挖掘详细的日志。
spawned uWSGI worker 1 (pid: 27353, cores: 1)
--- no python application found, check your startup logs for errors ---
[pid: 27353|app: -1|req: -1/1] 172.17.1.143 () {28 vars in 334 bytes} [Thu Mar 26 17:37:01 2020] GET / => generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 0)
并且发生此错误。
*** Operational MODE: single process ***
Traceback (most recent call last):
File "./myapp/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 master process (pid: 1705)
spawned uWSGI worker 1 (pid: 1706, cores: 1)
spawned uWSGI http 1 (pid: 1707)
错误发生在这里
from django.core.wsgi import get_wsgi_application
我也在用 anaconda3
$conda activate py37
然后
启动此命令
$uwsgi --ini uwsgi.ini
我解决了问题,问题出在uwsgi本身。
我的设置文件还可以。
通过安装uwsgi conda
conda install -c conda-forge libiconv
conda install -c conda-forge uwsgi
然后启动uwsgi /home/ubuntu/anaconda3/envs/py37/bin/uwsgi --ini uwsgi.ini
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句