I am on a PC running Windows 10. I am in the early stages of learning 
python and flask for web development purposes and I want to set up a local 
development environment. I have been using wamp for php development and 
have a successful installation of wampserver 3.0.6 64bit which runs Apache 
2.4.23. I now want to use that for python/flask and the way to do that 
appears to be via mod_wsgi. Thanks to an exchange with Graham Dumpleton in 
Stackoverflow I am aware of the documentation for mod_wsgi and have read 
that but clearly I have not fully understood it or complied with it 
correctly and the system isn't working.

Incidentally I have managed to get a VirtualEnvironment working which I 
think uses an inbuilt python server but I don't think that solves the 
problem of connecting to a database.

Anyway this is what I have done so far:

1. Successfully installed Python 3.6

2. Successfully installed flask (evidence for which is that the 
VirtualEnvironment works)

3. Successfully (I think) installed mod_wsgi via 'pip install mod_wsgi'
    
4. Run command 'mod_wsgi-express module-config' and copied the output to my 
apache httpd.conf file.

5. Changed the httpd.conf LogLevel to 'info'

6. Commented out the line 'AddHandler cgi-script .cgi .py'

7. Created simple wsgi application (copy/paste from documentation), called 
'test.wsgi'  in a folder C:\wamp\www\wsgi_script

8. Set up a virtual host in the httpd-vhosts.conf file using the following 
code:

    <VirtualHost *:80>
        ServerName localhost
        WSGIScriptAlias /test C:/wamp/www/wsgi_script/test.wsgi
        <Directory C:/wamp/www/wsgi_script>
        Order allow,deny
        Allow from all
        </Directory>
    </VirtualHost>
    
    which I expect may be wrong but I don't understand it enough to know 
what.
    
9. Run a check on the server via 'C:\wamp\bin\apache\apache2.4.23\bin>httpd 
-V'
which seemed to give a satisfactory response showing the version as 2.4.23 
and the MPM as WinNT.

10. In the browser (Firefox) entered following in url bar 
'http://localhost/wsgi_script/test.wsgi'. The output is merely the raw code 
of the file.

There are things I expected to happen that didn't eg

After installing mod_wsgi, I expected a module 'mod_wsgi.so' to appear in 
the apache modules folder but it did not.

I expected to have to load that module via a LoadModule line in httpd.conf 
but didn't see any advice to that effect.

When I look at the containing fiolder in the browser ie 
'http://localhost/wsgi_script/' I see the 'index of' page at the bottom of 
which is
    Apache/2.4.23 (Win64) PHP/5.6.25 mod_wsgi/4.5.17 Python/3.6 Server at 
localhost Port 80
which seems to indicate that apache is recognising mod_wsgi

Having tried to access the wsgi file, the apache error log read:

[Thu Aug 17 00:07:41.135713 2017] [auth_digest:notice] [pid 5416:tid 540] 
AH01757: generating secret for digest authentication ...
[Thu Aug 17 00:07:41.151640 2017] [wsgi:info] [pid 5416:tid 540] mod_wsgi 
(pid=5416): Python home c:/python36.
[Thu Aug 17 00:07:41.151640 2017] [wsgi:info] [pid 5416:tid 540] mod_wsgi 
(pid=5416): Initializing Python.
[Thu Aug 17 00:07:41.168231 2017] [wsgi:info] [pid 5416:tid 540] mod_wsgi 
(pid=5416): Attach interpreter ''.
[Thu Aug 17 00:07:41.182267 2017] [wsgi:info] [pid 5416:tid 540] mod_wsgi 
(pid=5416): Imported 'mod_wsgi'.
[Thu Aug 17 00:07:41.184272 2017] [mpm_winnt:notice] [pid 5416:tid 540] 
AH00354: Child: Starting 64 worker threads.
[Thu Aug 17 09:54:05.412979 2017] [core:info] [pid 5416:tid 1260] [client 
127.0.0.1:50861] AH00128: File does not exist: C:/wamp/www/test

I hope this is enough information to pick up my errors and suggest 
corrections or further tests.

-- 
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to