From 99bc0dfd3bc866a67e6d56a62f0edbf773dcb5b6 Mon Sep 17 00:00:00 2001 From: Michael Klich Date: Thu, 29 Oct 2015 11:24:39 +0000 Subject: [PATCH] Add info about working with VE and Python 3 Python 3 does not have execfile function. --- docs/deploying/mod_wsgi.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/deploying/mod_wsgi.rst b/docs/deploying/mod_wsgi.rst index 41b82c2b..c1ce170a 100644 --- a/docs/deploying/mod_wsgi.rst +++ b/docs/deploying/mod_wsgi.rst @@ -193,5 +193,11 @@ Add the following lines to the top of your ``.wsgi`` file:: activate_this = '/path/to/env/bin/activate_this.py' execfile(activate_this, dict(__file__=activate_this)) +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)) + This sets up the load paths according to the settings of the virtual environment. Keep in mind that the path has to be absolute.