configure mod_wsgi to run with python3.6

2,245 views
Skip to first unread message

nitzan...@blueteamglobal.com

unread,
Apr 16, 2018, 8:43:56 AM4/16/18
to modwsgi
Hey,
I have an ubuntu server with apache that I would like to run my Flask app on (python3.6).
I have installed mod_wsgi and enabled it:
sudo apt-get install libapache2-mod-wsgi 
sudo a2enmod wsgi


I have a file in my project "runtime.txt" that has inside "python-3.6.3"
When I try to surf to the site, I get "Internal Server Error" and that's because my project could only run with python versions 3.6+ (it has type hinting).

When looking in the apache logs, I see that it runs python2.7
mod_wsgi: Compiled for Python/2.7.11.
mod_wsgi: Runtime using Python/2.7.12.

Thanks,
Nitzan

Graham Dumpleton

unread,
Apr 16, 2018, 8:47:58 AM4/16/18
to mod...@googlegroups.com
You cannot point mod_wsgi compiled for Python 2.7 at a Python 3.6 virtual environment. This is explained in the documentation on virtual environments.


You will need to uninstall the system package for mod_wsgi and compiled mod_wsgi yourself from source code against Python 3.6 and use it.

The easiest way to do that is to use the 'pip install mod_wsgi' method described in:


Once installed, use 'mod_wsgi-express start-server' if using to use it for development from the command line.

To integrate into system Apache for permanent solution, run ``mod_wsgi-express module-config`` to get the configuration to include into Apache to load your compiled mod_wsgi module. Then configure Apache as per normal.

Ensure you read write through the PyPi doc page for mod_wsgi as it explains more about manual integration using 'pip install' version.

Graham

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

Reply all
Reply to author
Forward
0 new messages