Python Forum
What do I put in the "module" argument in a uwsgi.ini file? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Networking (https://python-forum.io/forum-12.html)
+--- Thread: What do I put in the "module" argument in a uwsgi.ini file? (/thread-22362.html)



What do I put in the "module" argument in a uwsgi.ini file? - david503 - Nov-10-2019

Ok I think this should be a simple question since I've boiled it down after hours to this:

I can run this and it works fine:

bog@bog-Lenovo-Product:~/myapp/myappdjango/myappdjango$ pwd
/home/bog/myapp/myappdjango/myappdjango

bog@bog-Lenovo-Product:~/myapp/myappdjango/myappdjango$ ls -al
total 68
drwxr-xr-x 6 bog bog 4096 Nov  9 22:45 .
drwxr-xr-x 4 bog bog 4096 Nov  9 22:17 ..
drwxr-xr-x 2 bog bog 4096 Nov  8 04:03 admin
-rw-r--r-- 1 bog bog    0 Nov  8 03:18 __init__.py
-rw-r--r-- 1 bog bog  112 Nov  8 04:00 __init__.pyc
-rw-r--r-- 1 bog bog  619 Nov  9 22:31 localmysite_uwsgi.ini
-rwxr-xr-x 1 bog bog  632 Nov  8 12:56 manage.py
drwxr-xr-x 2 bog bog 4096 Nov  8 13:04 media
srw-rw-rw- 1 bog bog    0 Nov  9 22:45 mysite.sock
drwxr-xr-x 2 bog bog 4096 Nov  9 22:26 __pycache__
-rw-r--r-- 1 bog bog 3180 Nov  8 12:55 settings.py
-rw-r--r-- 1 bog bog 2593 Nov  8 04:00 settings.pyc
drwxr-xr-x 2 bog bog 4096 Nov  8 12:41 static
-rw-r--r-- 1 bog bog  166 Nov  8 03:26 test.py
-rw-r--r-- 1 bog bog  753 Nov  8 03:18 urls.py
-rw-r--r-- 1 bog bog  945 Nov  8 04:00 urls.pyc
-rw-r--r-- 1 bog bog  664 Nov  8 14:28 uwsgi_params
-rw-r--r-- 1 bog bog  399 Nov  8 03:18 wsgi.py
-rw-r--r-- 1 bog bog  577 Nov  8 04:00 wsgi.pyc

bog@bog-Lenovo-Product:~/myapp/myappdjango/myappdjango$ uwsgi --socket mysite.sock --wsgi-file test.py --chmod-socket=666
That works fine; it's connected to nginx and it receives requests.

All I need help with is to put that line into an .ini. As in just so I can run:

uwsgi --ini localmysite_uwsgi.ini

There's something wrong with the "module" argument. I guess I don't know what to put there python (and/or wgsi) apparently uses some wacky naming convention instead of naming actual files? I finally found that out here:

https://www.quora.com/Where-is-Djangos-wsgi-file-I-see-only-wsgi-py-only

You can see my failed attempts in the #comments:

# localmysite_uwsgi.ini file
[uwsgi]

# Django-related settings
# the base directory (full path)
chdir           = /home/bog/myapp/myappdjango/myappdjango
# Django's wsgi file
module          = myappdjango
#module          = myappdjango.wsgi
#module          = wsgi.wsgi
#module          = wsgi.py
#module          = test.wsgi
#module          = test.py

# the virtualenv (full path)
home            = /home/bog/myapp

# process-related settings
# master
master          = true
# maximum number of worker processes
processes       = 10
# the socket (use the full path to be safe
socket          = /home/bog/myapp/myappdjango/myappdjango/mysite.sock
# ... with appropriate permissions - may be needed
chmod-socket    = 666
# clear environment on exit
vacuum          = true
The error I get with any of those attempts is:

ModuleNotFoundError: No module named 'test.py'; 'test' is not a package
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***

Thanks

d