问题
Here is how I start django with uWSGI.
command = /usr/local/bin/uwsgi --loop gevent --socket 127.0.0.1:8070 --processes 2 --pp =/home/ubuntu/workspace/htFrontEnd/htdjango --wsgi-file =/home/ubuntu/workspace/htFrontEnd/htdjango/wsgi.py -b 32768 --master --async 20 --enable-threads --listen 2048
Here is the error I get in the logs....
The location of wsgi.phy is correct: /home/ubuntu/workspace/htFrontEnd/htdjango/wsgi.py
your memory page size is 4096 bytes
detected max file descriptor number: 1024
async fd table size: 1024
allocated 20800 bytes (20 KB) for 20 cores per worker.
lock engine: pthread robust mutexes
uwsgi socket 0 bound to TCP address 127.0.0.1:8070 fd 3
Python version: 2.7.3 (default, Aug 1 2012, 05:25:23) [GCC 4.6.3]
Python main interpreter initialized at 0xab4ef0
python threads support enabled
your server socket listen backlog is limited to 2048 connections
*** Operational MODE: preforking+async ***
added =/home/ubuntu/workspace/htFrontEnd/htdjango to pythonpath.
failed to open python file =/home/ubuntu/workspace/htFrontEnd/htdjango/wsgi.py
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: 1935)
spawned uWSGI worker 1 (pid: 2037, cores: 20)
spawned uWSGI worker 2 (pid: 2038, cores: 20)
*** running gevent loop engine [addr:0x44f950] ***
timeout. skip request.
Here is my wsgi.py file.
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "htdjango.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
回答1:
it is a typo:
remove the = (equal sign) from =/home/ubuntu/workspace/htFrontEnd/htdjango/wsgi.py and from =/home/ubuntu/workspace/htFrontEnd/htdjango
回答2:
I noticed that this is already happening - added =/home/ubuntu/workspace/htFrontEnd/htdjango to pythonpath.
but just to be sure, can you add in one more line into your wsgi.py
file -
`sys.path.append('/home/ubuntu/workspace/htFrontEnd/htdjango')`
And let me know if anything else changes in your stdout when you try running it again.
There is certainly something wrong when application = get_wsgi_application()
happens as this error message is telling us that uwsgi cannot find our django application.
Are you using virtualenv by any chance? And your django library is in virtualenv itself?
来源:https://stackoverflow.com/questions/13218799/django-uwsgi-gevent-loop-how-to-get-to-get-to-work-unable-to-load-app-0-m