The Wayback Machine - https://web.archive.org/web/20200304104508/https://github.com/pallets/flask/issues/1948
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for Flask + mod_wsgi + pyvenv + Python 3 doesn't work #1948

Open
cdman opened this issue Jul 7, 2016 · 2 comments
Open

Documentation for Flask + mod_wsgi + pyvenv + Python 3 doesn't work #1948

cdman opened this issue Jul 7, 2016 · 2 comments
Labels

Comments

@cdman
Copy link

@cdman cdman commented Jul 7, 2016

It says in the documentation (the last section - "Working with Virtual Environments"):

For Python 3 add the following lines to the top of your .wsgi file:

activate_this = '/path/to/env/bin/activate_this.py'
with open(activate_this) as file_:
    exec(file_.read(), dict(__file__=activate_this))

However activate_this.py is no longer present in pyvenv (see http://bugs.python.org/issue21496), thus the above code doesn't work. I found a stackoverflow answer where it said that just copying activate_this.py from a 2.7 virtualenv might work, however I didn't go down that route.

How I managed to get it working:

I added WSGIPythonHome /path/to/env to the top level of my apache config (ie. outside of VirtualEnv). However that might be a little to big of a hammer if people want to run multiple applications in the same Apache instance. In that case setting python-path on WSGIDaemonProcess might work (however I didn't try it out).

@Thynix

This comment has been minimized.

Copy link

@Thynix Thynix commented Jan 1, 2017

python-home on WSGIDaemonProcess also exists, but as I'm having similar problems currently I can't speak to whether it works.

@Thynix

This comment has been minimized.

Copy link

@Thynix Thynix commented Jan 1, 2017

python-home was added in mod_wsgi version 3.4. I think it'd be reasonable (and once / if I get this weirdness sorted out I intend to open a pull request) to depend on this in the documentation because:

  • 3.4 was released in 2012
  • 3.5 was released in 2014, contains a fix for a local privilege escalation vulnerability when using daemon mode, and the releases notes "[recommend] that prior versions of mod_wsgi not be used."
  • Debian Jessie ships 4.3.0 as of this writing.
@davidism davidism added the docs label Jun 5, 2017
@davidism davidism modified the milestone: 1.0 Jul 31, 2017
@davidism davidism modified the milestones: 1.0, 1.1 Mar 8, 2018
@davidism davidism removed this from the 1.1.0 milestone May 30, 2019
@jab jab added the save-for-sprint label May 30, 2019
@pallets pallets deleted a comment from Ajiteshrock Oct 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants
You can’t perform that action at this time.