Apache/XAMPP with Python

Alles, was den Apache betrifft, kann hier besprochen werden.

Apache/XAMPP with Python

Postby matjung » 19. January 2017 19:31

I know Xampp is mainly about PHP, but it also works with Python.
I found plenty of instructions on the web, that actually don't work.
For the following environment it works for me:
Code: Select all
SERVER_SIGNATURE    <address>Apache/2.4.23 (Win32) OpenSSL/1.0.2h mod_wsgi/4.4.23 Python/3.6.0 PHP/7.0.13 Server at localhost Port 80</address>
SERVER_SOFTWARE    Apache/2.4.23 (Win32) OpenSSL/1.0.2h mod_wsgi/4.4.23 Python/3.6.0 PHP/7.0.13


Code: Select all
httpd-xampp.conf
WSGIScriptAliasMatch /python/ "G:/htdocs/python/"
<Directory "G:/htdocs/python">
       Options Indexes FollowSymLinks MultiViews
      DirectoryIndex index.py
        AllowOverride all
        Order Deny,Allow
        Allow from all
        Require all granted
</Directory>


Code: Select all
httpd.conf
LoadModule wsgi_module modules/mod_wsgi.so


Code: Select all
def application(environ, start_response):
    status = '200 OK'
    output = b'Greetings from Python to Apache'
    response_headers = [('Content-type', 'text/plain'), ('Content-Length', str(len(output)))]
    start_response(status, response_headers)
    return [output]

    http://localhost/python/test1.py -> G:/htdocs/python/test1.py
    http://localhost/python/test2.py -> G:/htdocs/python/test2.py
    http://localhost/python -> G:/htdocs/python/index.py

First install xampp, then Python.
For getting mod_wsgi.so, follow these instructions or ask Xampp for a new Xampp release

https://github.com/GrahamDumpleton/mod_wsgi/blob/develop/win32/README.rst
matjung
 
Posts: 3
Joined: 24. December 2016 22:33
XAMPP version: 1.8.1
Operating System: Windows 10 64

Return to Apache

Who is online

Users browsing this forum: No registered users and 6 guests