[Python] How to get mod_wsgi to pick up my virtualenv

Discussão em 'Python' iniciado por Stack, Março 16, 2025.

  1. Stack

    Stack Membro Participativo

    I'm very new to working with Flask-

    according to http://flask.pocoo.org/docs/0.12/deploying/mod_wsgi/

    under the heading "Working with Virtual Environments" I read:


    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.
    ​

    to activate my venv I use the command from linux:

    my_env/bin/activate


    I looked in my my_env/bin/ directory and do not see any .py files. Am I suppose to create a .py file that in my_env/bin/ that will be called by the .wsgi file?

    Continue reading...

Compartilhe esta Página