On my Google Compute Engine instance, I have been trying to setup my application server (uWSGI) following these steps:
- cd /path/to/project/directory
- workon virtual_env
- uwsgi --ini uwsgi.ini
Every time I initialize uWSGI, the following error is thrown (a more extensive log below):
ImportError: No module named '"adtor'
unable to load app 0 (mountpoint='') (callable not found or import error)
I'm able to run the development server alone (python manage.py runserver). It is peculiar that there is an extra double quote (") before my django application's name, but am unable to find any instances of an extra double quote within code, the .ini, virtual env hooks (e.g. postactivate). Beyond this, I'm unable to find a potential culprit; I'd assume it is either within my .ini file or improperly installed some third-party library.
"pip freeze":
appdirs==1.4.3
Django==1.8.5
django-filter==1.0.2
django-model-utils==3.0.0
djangorestframework==3.6.2
mysqlclient==1.3.10
packaging==16.8
pyparsing==2.2.0
six==1.10.0
uWSGI==2.0.15
uwsgi.ini
[uwsgi]
socket=127.0.0.1:8000
stats=127.0.0.1:9191
http-timeout=1800
uid=www-data
gid=www-data
virtualenv=/home/tor/.virtualenvs/adtor_prod
home=/home/tor/.virtualenvs/adtor_prod
chdir=/srv/django/adtor_project/prime
module=adtor.wsgi:application
master=true
vacuum=true
thunder-lock=true
pidfile=/tmp/project-master.pid
daemonize=/var/log/uwsgi/adtor-blog.log
threads=2
enable-threads=true
for-readline = /etc/srv/vars.txt
env = %(_)
endfor =
Log:
*** Starting uWSGI 2.0.15 (64bit) on [Fri May 5 16:00:56 2017] ***
compiled with version: 4.8.4 on 02 May 2017 17:47:17
os: Linux-4.4.0-75-generic #96~14.04.1-Ubuntu SMP Thu Apr 20 11:06:30 UTC 2017
nodename: instance-1
machine: x86_64
clock source: unix
detected number of CPU cores: 1
current working directory: /srv/django/adtor_project
writing pidfile to /tmp/project-master.pid
detected binary path: /home/tor/.virtualenvs/adtor_prod/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
chdir() to /srv/django/adtor_project/prime
your processes number limit is 2257
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: enabled
uwsgi socket 0 bound to TCP address 127.0.0.1:8000 fd 3
Python version: 3.4.3 (default, Nov 17 2016, 01:12:14) [GCC 4.8.4]
Set PythonHome to /home/tor/.virtualenvs/adtor_prod
Python main interpreter initialized at 0x1a02ab0
python threads support enabled
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 166112 bytes (162 KB) for 2 cores
*** Operational MODE: threaded ***
Traceback (most recent call last):
File "./adtor/wsgi.py", line 16, in <module>
application = get_wsgi_application()
File "/home/tor/.virtualenvs/adtor_prod/lib/python3.4/site-packages/django/core/wsgi.py", line 14, in get_wsgi_application
django.setup()
File "/home/tor/.virtualenvs/adtor_prod/lib/python3.4/site-packages/django/__init__.py", line 17, in setup
configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
File "/home/tor/.virtualenvs/adtor_prod/lib/python3.4/site-packages/django/conf/__init__.py", line 48, in __getattr__
self._setup(name)
File "/home/tor/.virtualenvs/adtor_prod/lib/python3.4/site-packages/django/conf/__init__.py", line 44, in _setup
self._wrapped = Settings(settings_module)
File "/home/tor/.virtualenvs/adtor_prod/lib/python3.4/site-packages/django/conf/__init__.py", line 92, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/home/tor/.virtualenvs/adtor_prod/lib/python3.4/importlib/__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '"adtor'
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: 8753)
spawned uWSGI worker 1 (pid: 8755, cores: 2)
*** Stats server enabled on 127.0.0.1:9191 fd: 10 ***
"story looks like The double quotes were not proper double quotes, i.e.”instead of". Even if apparently not since your traceback does exhibit a real double quotes. - keepAliveos.environ.setdefault("DJANGO_SETTINGS_MODULE", "adtor.settings")also correctly written in the wsgi.py ? - keepAlive