Thanks for your response. Taking the points in turn:
Can you confirm that you are using the same Apache instance for PHP at the
same time as wanting to use it for Python? Yes that is correct
Many thanks for your response, Graham. Taking your point in turn:
Can you confirm that you are using the same Apache instance for PHP at the
same time as wanting to use it for Python? Yes that is correct
Post the details of the over VirtualHost.
Full content of the *httpd-vhosts.conf* file is as follows:
<VirtualHost *:80>
ServerName localhost
DocumentRoot c:/wamp/www
<Directory "c:/wamp/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
#
<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>
Also, what is DocumentRoot set to in the httpd.conf file? The code line is
*DocumentRoot
"${INSTALL_DIR}/www"* and earlier there is *Define INSTALL_DIR c:/wamp*
which presumably defines the variable.
What did step 4 output and what did you add to the httpd.conf file? The
following:
LoadFile "c:/python36/python36.dll"
LoadModule wsgi_module
"c:/python36/lib/site-packages/mod_wsgi/server/mod_wsgi.cp36-win_amd64.pyd"
WSGIPythonHome "c:/python36"
Is there any existing LoadModule line for wsgi_module anywhere else in the
httpd.conf file. Answer no - confirmed by file search
Hope that sheds some light.
On Thursday, August 17, 2017 at 10:24:33 AM UTC+1, Graham Dumpleton wrote:
>
>
> On 17 Aug 2017, at 7:15 pm, Mike Heath <[email protected] <javascript:>>
> wrote:
>
> 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.
>
>
> Can you confirm that you are using the same Apache instance for PHP at the
> same time as wanting to use it for Python?
>
> 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>
>
>
> Do you have any other VirtualHost definitions in the httpd.conf file?
>
> If you do and the other one is set up for PHP this second VirtualHost
> would be ignored. Post the details of the over VirtualHost.
>
> Also, what is DocumentRoot set to in the httpd.conf file?
>
> 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.
>
>
> When C extensions are compiled by Python they can have a .pyd or .pyo
> extension.
>
> I expected to have to load that module via a LoadModule line in httpd.conf
> but didn't see any advice to that effect.
>
>
> Step 4 would have output what to include in the httpd.conf file. That
> would have included LoadFile, LoadModule and WSGIPythonHome directives. The
> LoadModule line output at step 4 would use whatever is appropriate
> extension, which need not be .so.
>
> What did step 4 output and what did you add to the httpd.conf file?
>
> Is there any existing LoadModule line for wsgi_module anywhere else in the
> httpd.conf file.
>
> 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] <javascript:>.
> To post to this group, send email to [email protected] <javascript:>
> .
> Visit this group at https://groups.google.com/group/modwsgi.
> For more options, visit 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 [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.