You possibly should be using:

WSGIPythonPath "D:\Django\myproject"

and not:

WSGIPythonPath "D:\Django\myproject\myproject"
It needs to refer to the parent directory of the Django project directory, not 
the project directory itself.

Graham

> On 9 Feb 2019, at 12:18 am, Mike Dannenberg <dannenberg.m...@gmail.com> wrote:
> 
> I'm trying to get Django 2.2 to run on Apache 2.4 with Python 3.7 on a 
> Windows 2016 Server. Django runs fine on the development server (manage.py 
> runserver) and the Apache Server runs and is reachable on the network but 
> Django doesn't run on Apache. This is the Apache config (httpd.conf) I'm 
> running:
> 
> 
> 
> ServerName localhost:80
> 
> 
> <Directory />
>     AllowOverride none
>     Require all denied
> </Directory>
> 
> LoadFile "c:/program files/python37/python37.dll"
> LoadModule wsgi_module "c:/program 
> files/python37/lib/site-packages/mod_wsgi/server/mod_wsgi.cp37-win_amd64.pyd"
> WSGIPythonHome "c:/program files/python37"
> WSGIScriptAlias \ "D:\Django\myproject\myproject\wsgi.py"
> WSGIPythonPath "D:\Django\myproject\myproject"
> 
> <Directory "D:\Django\myproject\myproject">
>     <Files wsgi.py>
>         Require all granted
>     </Files>
> </Directory>
> 
> DocumentRoot "${SRVROOT}/htdocs"
> <Directory "${SRVROOT}/htdocs">
> 
>     Options Indexes FollowSymLinks
>     AllowOverride None    
>     Require all granted
> </Directory>
> 
> <IfModule dir_module>
>     DirectoryIndex index.html
> </IfModule>
> 
> 
> Here's my wsgi.py (not changed from what was generated during manage.py 
> startproject):
> 
> import os
> 
> from django.core.wsgi import get_wsgi_application
> 
> os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')
> 
> application = get_wsgi_application()
> 
> 
> When I try to load http://myserver <http://myserver/> in the browser, I get 
> the Apache Defualt page, but If I try to load http://myserver:8000 
> <http://myserver:8000/> I get a connection error.
> 
> 
> 
> 
> 
> 
> 
> Here are the relevant entries of error.log:
> 
> [Fri Feb 08 11:30:15.853857 2019] [wsgi:info] [pid 864:tid 436] mod_wsgi 
> (pid=864): Python home c:/program files/python37.
> [Fri Feb 08 11:30:15.853857 2019] [wsgi:info] [pid 864:tid 436] mod_wsgi 
> (pid=864): Initializing Python.
> [Fri Feb 08 11:30:15.869484 2019] [wsgi:info] [pid 864:tid 436] mod_wsgi 
> (pid=864): Attach interpreter ''.
> [Fri Feb 08 11:30:15.885109 2019] [wsgi:info] [pid 864:tid 436] mod_wsgi 
> (pid=864): Adding 'D:\\Django\\myproject\\myproject' to path.
> [Fri Feb 08 11:30:15.885109 2019] [wsgi:info] [pid 864:tid 436] mod_wsgi 
> (pid=864): Imported 'mod_wsgi'.
> Looks like it loads fine, but it doesn't even try to listen on port 8000.
> 
> 
> 
> 
> 
> 
> 
> So my setting for WSGIScriptAlias seems to have been wrong. Now it's at least 
> trying to load the WSGI app.
> 
> [Fri Feb 08 12:28:02.123312 2019] [wsgi:info] [pid 856:tid 1212] mod_wsgi 
> (pid=856): Create interpreter 'localhost|/test'.
> [Fri Feb 08 12:28:02.138940 2019] [wsgi:info] [pid 856:tid 1212] mod_wsgi 
> (pid=856): Adding 'D:\\Django\\kte_test\\kte_test' to path.
> [Fri Feb 08 12:28:02.138940 2019] [wsgi:info] [pid 856:tid 1212] [client 
> 172.16.27.254:51858] mod_wsgi (pid=856, process='', 
> application='localhost|/test'): Loading Python script file 
> 'D:/Django/kte_test/kte_test/wsgi.py'.
> [Fri Feb 08 12:28:02.310819 2019] [wsgi:error] [pid 856:tid 1212] [client 
> 172.16.27.254:51858] mod_wsgi (pid=856): Failed to exec Python script file 
> 'D:/Django/kte_test/kte_test/wsgi.py'.
> [Fri Feb 08 12:28:02.310819 2019] [wsgi:error] [pid 856:tid 1212] [client 
> 172.16.27.254:51858] mod_wsgi (pid=856): Exception occurred processing WSGI 
> script 'D:/Django/kte_test/kte_test/wsgi.py'.
> [Fri Feb 08 12:28:02.310819 2019] [wsgi:error] [pid 856:tid 1212] [client 
> 172.16.27.254:51858] Traceback (most recent call last):\r
> [Fri Feb 08 12:28:02.310819 2019] [wsgi:error] [pid 856:tid 1212] [client 
> 172.16.27.254:51858]   File "D:/Django/kte_test/kte_test/wsgi.py", line 16, 
> in <module>\r
> [Fri Feb 08 12:28:02.310819 2019] [wsgi:error] [pid 856:tid 1212] [client 
> 172.16.27.254:51858]     application = get_wsgi_application()\r
> [Fri Feb 08 12:28:02.310819 2019] [wsgi:error] [pid 856:tid 1212] [client 
> 172.16.27.254:51858]   File "c:\\program 
> files\\python37\\lib\\site-packages\\django\\core\\wsgi.py", line 12, in 
> get_wsgi_application\r
> [Fri Feb 08 12:28:02.310819 2019] [wsgi:error] [pid 856:tid 1212] [client 
> 172.16.27.254:51858]     django.setup(set_prefix=False)\r
> [Fri Feb 08 12:28:02.310819 2019] [wsgi:error] [pid 856:tid 1212] [client 
> 172.16.27.254:51858]   File "c:\\program 
> files\\python37\\lib\\site-packages\\django\\__init__.py", line 19, in setup\r
> [Fri Feb 08 12:28:02.310819 2019] [wsgi:error] [pid 856:tid 1212] [client 
> 172.16.27.254:51858]     configure_logging(settings.LOGGING_CONFIG, 
> settings.LOGGING)\r
> [Fri Feb 08 12:28:02.310819 2019] [wsgi:error] [pid 856:tid 1212] [client 
> 172.16.27.254:51858]   File "c:\\program 
> files\\python37\\lib\\site-packages\\django\\conf\\__init__.py", line 57, in 
> __getattr__\r
> [Fri Feb 08 12:28:02.310819 2019] [wsgi:error] [pid 856:tid 1212] [client 
> 172.16.27.254:51858]     self._setup(name)\r
> [Fri Feb 08 12:28:02.310819 2019] [wsgi:error] [pid 856:tid 1212] [client 
> 172.16.27.254:51858]   File "c:\\program 
> files\\python37\\lib\\site-packages\\django\\conf\\__init__.py", line 44, in 
> _setup\r
> [Fri Feb 08 12:28:02.310819 2019] [wsgi:error] [pid 856:tid 1212] [client 
> 172.16.27.254:51858]     self._wrapped = Settings(settings_module)\r
> [Fri Feb 08 12:28:02.310819 2019] [wsgi:error] [pid 856:tid 1212] [client 
> 172.16.27.254:51858]   File "c:\\program 
> files\\python37\\lib\\site-packages\\django\\conf\\__init__.py", line 107, in 
> __init__\r
> [Fri Feb 08 12:28:02.310819 2019] [wsgi:error] [pid 856:tid 1212] [client 
> 172.16.27.254:51858]     mod = importlib.import_module(self.SETTINGS_MODULE)\r
> [Fri Feb 08 12:28:02.310819 2019] [wsgi:error] [pid 856:tid 1212] [client 
> 172.16.27.254:51858]   File "c:\\program 
> files\\python37\\lib\\importlib\\__init__.py", line 127, in import_module\r
> [Fri Feb 08 12:28:02.310819 2019] [wsgi:error] [pid 856:tid 1212] [client 
> 172.16.27.254:51858]     return _bootstrap._gcd_import(name[level:], package, 
> level)\r
> [Fri Feb 08 12:28:02.310819 2019] [wsgi:error] [pid 856:tid 1212] [client 
> 172.16.27.254:51858]   File "<frozen importlib._bootstrap>", line 1006, in 
> _gcd_import\r
> [Fri Feb 08 12:28:02.310819 2019] [wsgi:error] [pid 856:tid 1212] [client 
> 172.16.27.254:51858]   File "<frozen importlib._bootstrap>", line 983, in 
> _find_and_load\r
> [Fri Feb 08 12:28:02.310819 2019] [wsgi:error] [pid 856:tid 1212] [client 
> 172.16.27.254:51858]   File "<frozen importlib._bootstrap>", line 953, in 
> _find_and_load_unlocked\r
> [Fri Feb 08 12:28:02.310819 2019] [wsgi:error] [pid 856:tid 1212] [client 
> 172.16.27.254:51858]   File "<frozen importlib._bootstrap>", line 219, in 
> _call_with_frames_removed\r
> [Fri Feb 08 12:28:02.310819 2019] [wsgi:error] [pid 856:tid 1212] [client 
> 172.16.27.254:51858]   File "<frozen importlib._bootstrap>", line 1006, in 
> _gcd_import\r
> [Fri Feb 08 12:28:02.310819 2019] [wsgi:error] [pid 856:tid 1212] [client 
> 172.16.27.254:51858]   File "<frozen importlib._bootstrap>", line 983, in 
> _find_and_load\r
> [Fri Feb 08 12:28:02.310819 2019] [wsgi:error] [pid 856:tid 1212] [client 
> 172.16.27.254:51858]   File "<frozen importlib._bootstrap>", line 965, in 
> _find_and_load_unlocked\r
> [Fri Feb 08 12:28:02.310819 2019] [wsgi:error] [pid 856:tid 1212] [client 
> 172.16.27.254:51858] ModuleNotFoundError: No module named 'myproject'\r
> 
> 
> 
> 
> Where do I find the missing module?
> 
> 
> -- 
> 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 modwsgi+unsubscr...@googlegroups.com 
> <mailto:modwsgi+unsubscr...@googlegroups.com>.
> To post to this group, send email to modwsgi@googlegroups.com 
> <mailto:modwsgi@googlegroups.com>.
> Visit this group at https://groups.google.com/group/modwsgi 
> <https://groups.google.com/group/modwsgi>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
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 modwsgi+unsubscr...@googlegroups.com.
To post to this group, send email to modwsgi@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to