Where should WSGIPythonPath point in my virtualenv?

后端 未结 3 910
小蘑菇
小蘑菇 2020-12-30 01:02

I have a folder called python2.7 inside of lib in the virtual environment.

After reading half a dozen tutorials, I can\'t figure out exactl

3条回答
  •  無奈伤痛
    2020-12-30 01:36

    You are getting the error because WSGIPythonPath Directive cannot be used inside the VirtualHost context. You have to declare it inside your main Apache configuration file. If you still want to point to the directories in your virtualenv inside the VirtualHost context, Use WSGIDaemonProcess Directive instead, it has a python-path option for you to declare your relevant python directories.

    For example: your virtual host configuration file should look something like this:

    
    ServerName example.com
    CustomLog logs/example.com-access_log common
    ErrorLog logs/example.com-error_log
    
    WSGIDaemonProcess example.com python-path=/virtualenvpathto/site-packages:/pathto/exampleprojecthome
    WSGIProcessGroup example.com
    
    ...
    
    

    The full colon : is used when you have more than one python directories you want to be added to $PYTHON_PATH environment variable so that say import example.foo works fine. In the above example, there are two directories, they could be more or less depending on how you have setup your project.

    If you are on windows, use semicolon ; instead of full colon.

    I hope this helps.

提交回复
热议问题