Hi all,

I am trying to deploy a simple Django project on Apache 2.4.29 
(Ubuntu/Debian setup with apache2.conf, etc.). I installed mod_wsgi 
system-wide via pip3 (version 4.6.7), and the same version is also 
installed in the virtual environment. Django version 2.2.4, Python 3.6.8.

I have the site in a home/username directory, and a VirtualHost 
configuration on port 80 in /etc/apache2/sites-available 
(username.sitename.org below). 

My error log looks like this:

/var/log/apache2/error.log:

mod_wsgi (pid=13012, process='username.sitename.org', 
application='username.sitename.org|'): Loading Python script file 
'/home/username/cvenv/usernamesite/cssite/wsgi.py'.
[Wed Sep 11 10:10:38.198919 2019] [wsgi:error] [pid 13012:tid 
140572140205824] [remote 12.345.678.910:58010] mod_wsgi (pid=13012): Failed 
to exec Python script file 
'/home/username/cvenv/usernamesite/cssite/wsgi.py'.
[Wed Sep 11 10:10:38.198954 2019] [wsgi:error] [pid 13012:tid 
140572140205824] [remote 12.345.678.910:58010] mod_wsgi (pid=13012): 
Exception occurred processing WSGI script 
'/home/username/cvenv/usernamesite/cssite/wsgi.py'.
[Wed Sep 11 10:10:38.199364 2019] [wsgi:error] [pid 13012:tid 
140572140205824] [remote 12.345.678.910:58010] Traceback (most recent call 
last):
[Wed Sep 11 10:10:38.199392 2019] [wsgi:error] [pid 13012:tid 
140572140205824] [remote 12.345.678.910:58010]   File 
"/home/username/cvenv/usernamesite/cssite/wsgi.py", line 25, in <module>
[Wed Sep 11 10:10:38.199396 2019] [wsgi:error] [pid 13012:tid 
140572140205824] [remote 12.345.678.910:58010]     application = 
get_wsgi_application()
[Wed Sep 11 10:10:38.199401 2019] [wsgi:error] [pid 13012:tid 
140572140205824] [remote 12.345.678.910:58010]   File 
"/home/username/cvenv/lib/python3.6/site-packages/django/core/wsgi.py", 
line 12, in get_wsgi_application
[Wed Sep 11 10:10:38.199404 2019] [wsgi:error] [pid 13012:tid 
140572140205824] [remote 12.345.678.910:58010]     
django.setup(set_prefix=False)
[Wed Sep 11 10:10:38.199408 2019] [wsgi:error] [pid 13012:tid 
140572140205824] [remote 12.345.678.910:58010]   File 
"/home/username/cvenv/lib/python3.6/site-packages/django/__init__.py", line 
24, in setup
[Wed Sep 11 10:10:38.199410 2019] [wsgi:error] [pid 13012:tid 
140572140205824] [remote 12.345.678.910:58010]     
apps.populate(settings.INSTALLED_APPS)
[Wed Sep 11 10:10:38.199414 2019] [wsgi:error] [pid 13012:tid 
140572140205824] [remote 12.345.678.910:58010]   File 
"/home/username/cvenv/lib/python3.6/site-packages/django/apps/registry.py", 
line 91, in populate
[Wed Sep 11 10:10:38.199417 2019] [wsgi:error] [pid 13012:tid 
140572140205824] [remote 12.345.678.910:58010]     app_config = 
AppConfig.create(entry)
[Wed Sep 11 10:10:38.199420 2019] [wsgi:error] [pid 13012:tid 
140572140205824] [remote 12.345.678.910:58010]   File 
"/home/username/cvenv/lib/python3.6/site-packages/django/apps/config.py", 
line 90, in create
[Wed Sep 11 10:10:38.199423 2019] [wsgi:error] [pid 13012:tid 
140572140205824] [remote 12.345.678.910:58010]     module = 
import_module(entry)
[Wed Sep 11 10:10:38.199426 2019] [wsgi:error] [pid 13012:tid 
140572140205824] [remote 12.345.678.910:58010]   File 
"/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
[Wed Sep 11 10:10:38.199429 2019] [wsgi:error] [pid 13012:tid 
140572140205824] [remote 12.345.678.910:58010]     return 
_bootstrap._gcd_import(name[level:], package, level)
[Wed Sep 11 10:10:38.199439 2019] [wsgi:error] [pid 13012:tid 
140572140205824] [remote 12.345.678.910:58010]   File "<frozen 
importlib._bootstrap>", line 994, in _gcd_import
[Wed Sep 11 10:10:38.199443 2019] [wsgi:error] [pid 13012:tid 
140572140205824] [remote 12.345.678.910:58010]   File "<frozen 
importlib._bootstrap>", line 971, in _find_and_load
[Wed Sep 11 10:10:38.199446 2019] [wsgi:error] [pid 13012:tid 
140572140205824] [remote 12.345.678.910:58010]   File "<frozen 
importlib._bootstrap>", line 953, in _find_and_load_unlocked
[Wed Sep 11 10:10:38.199457 2019] [wsgi:error] [pid 13012:tid 
140572140205824] [remote 12.345.678.910:58010] ModuleNotFoundError: No 
module named 'm'

And my configuration:

/etc/apache2/sites-available/username.sitename.conf:

<VirtualHost *:80>
        DocumentRoot "/home/username/cvenv/usernamesite"
        WSGIScriptAlias / /home/username/cvenv/usernamesite/cssite/wsgi.py
        WSGIDaemonProcess username.sitename.org user=username 
group=username threads=15 display-name=%{GROUP} 
python-home=/home/username/cvenv 
python-path=/home/username/cvenv/usernamesite
        WSGIProcessGroup username.sitename.org
        ServerName username.sitename.org
        ServerAlias username.sitename.org

        <Directory /home/username/cvenv/usernamesite>
        AllowOverride all
        Require all granted
        Options FollowSymLinks
        </Directory>

        Alias /static/ /home/username/cvenv/usernamesite/static/

        <Directory /home/username/cvenv/usernamesite/static>
        Require all granted
        </Directory>

        Alias /media/ /home/username/cvenv/usernamesite/media/

        <Directory /home/username/cvenv/usernamesite/media>
        Require all granted
        </Directory>

</VirtualHost>


My wsgi.py is the Django default.

The error in the log looks to me like something is going wrong with the 
python version or module version, but I am not sure. Searching for that 
particular error does not find anything useful...


-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/modwsgi/d8651da6-6874-404d-a699-af41569c671a%40googlegroups.com.

Reply via email to