简体   繁体   中英

ImportError: No module named django.core.wsgi for wsgi server setting

I am setting with djano and uwsgi

$uwsgi --ini uwsgi.ini

My Django root is here /var/www/html/myapp/current

It must be quite simple setting however I am not sure the yet.

I have these two files

/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

The error is below, but I can't dig the detailed logs.

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)

And this error occurs.

*** 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)

error happens here

from django.core.wsgi import get_wsgi_application

Also I am using anaconda3

$conda activate py37 then

start this command

$uwsgi --ini uwsgi.ini

I solved the problem , the problem was uwsgi itself.

My setting file was ok.

install uwsgi by conda

conda install -c conda-forge libiconv

conda install -c conda-forge uwsgi

then start uwsgi /home/ubuntu/anaconda3/envs/py37/bin/uwsgi --ini uwsgi.ini

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM