Reputation: 2065
From my apache error log I'm getting the following output:
[Fri Feb 24 18:44:44.617451 2017] [mpm_winnt:notice] [pid 16752:tid 684] AH00354: Child: Starting 64 worker threads.
[Fri Feb 24 18:44:49.932581 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] mod_wsgi (pid=16752): Target WSGI script 'C:/Users/Rasmus/workspace/MainSite/src/MainSite/wsgi.py' cannot be loaded as Python module.
[Fri Feb 24 18:44:49.932581 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] mod_wsgi (pid=16752): Exception occurred processing WSGI script 'C:/Users/Rasmus/workspace/MainSite/src/MainSite/wsgi.py'.
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] Traceback (most recent call last):\r
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] File "C:/Users/Rasmus/workspace/MainSite/src/MainSite/wsgi.py", line 16, in <module>\r
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] application = get_wsgi_application()\r
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] File "c:\\anaconda3\\lib\\site-packages\\django\\core\\wsgi.py", line 13, in get_wsgi_application\r
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] django.setup()\r
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] File "c:\\anaconda3\\lib\\site-packages\\django\\__init__.py", line 17, in setup\r
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)\r
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] File "c:\\anaconda3\\lib\\site-packages\\django\\conf\\__init__.py", line 55, in __getattr__\r
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] self._setup(name)\r
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] File "c:\\anaconda3\\lib\\site-packages\\django\\conf\\__init__.py", line 43, in _setup\r
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] self._wrapped = Settings(settings_module)\r
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] File "c:\\anaconda3\\lib\\site-packages\\django\\conf\\__init__.py", line 99, in __init__\r
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] mod = importlib.import_module(self.SETTINGS_MODULE)\r
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] File "c:\\anaconda3\\lib\\importlib\\__init__.py", line 126, in import_module\r
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] return _bootstrap._gcd_import(name[level:], package, level)\r
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] File "<frozen importlib._bootstrap>", line 986, in _gcd_import\r
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] File "<frozen importlib._bootstrap>", line 969, in _find_and_load\r
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] File "<frozen importlib._bootstrap>", line 944, in _find_and_load_unlocked\r
[Fri Feb 24 18:44:49.945590 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed\r
[Fri Feb 24 18:44:49.946090 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] File "<frozen importlib._bootstrap>", line 986, in _gcd_import\r
[Fri Feb 24 18:44:49.946090 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] File "<frozen importlib._bootstrap>", line 969, in _find_and_load\r
[Fri Feb 24 18:44:49.946090 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked\r
[Fri Feb 24 18:44:49.946090 2017] [wsgi:error] [pid 16752:tid 1232] [client ::1:51965] ImportError: No module named 'MainSite'\r
I'm not entirely sure why this is coming. I've tried looking around but haven't found anything. But I'm thinking it has something to do with my wsgi.py file:
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "MainSite.settings")
application = get_wsgi_application()
This is just the default wsgi.py file. I haven't had any success finding anything about how the configuration should look like.
In my projects settings I have
DEBUG = True
ALLOWED_HOSTS = []
and installed the app
'mod_wsgi.server',
Specs: Apache/2.4.25 (Win64) - mod_wsgi/4.5.14 - Python/3.5 - Windows 10
I'm hoping someone could guide me in the right direction. Please tell me if there's any more information that I can provide.
httpd config:
Listen 8080
LoadModule wsgi_module "c:/anaconda3/lib/site-packages/mod_wsgi/server/mod_wsgi.cp35-win_amd64.pyd"
WSGIPythonHome "c:/anaconda3"
WSGIScriptAlias / C:/Users/Rasmus/workspace/MainSite/src/MainSite/wsgi.py
WSGIPythonPath C:/Users/Rasmus/workspace/MainSite/src/MainSite
<Directory C:/Users/Rasmus/workspace/MainSite/src/MainSite>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
Upvotes: 0
Views: 1386
Reputation: 58523
Use:
WSGIPythonPath C:/Users/Rasmus/workspace/MainSite/src
You have it one directory too low.
Upvotes: 1