简体   繁体   中英

Django and Passenger setup on shared host

I'm trying to setup Django on a shared hosting provider, Dreamhost. When serving a Django project, Passenger WSGI is used. This works with Dreamhost's default python, but is unable to find the modules in my virtualenv.

I changed my passenger_wsgi.py to include:

INTERP = "/home/<username>/.pythonbrew/venvs/Python-2.7.3/<venv>/bin/python"
if sys.executable != INTERP: os.execl(INTERP, INTERP, *sys.argv)

(as documented on http://wiki.dreamhost.com/Passenger_WSGI )

This breaks the site with a generic Internal Server Error. My Dreamhost log file doesn't provide much additional help: Premature end of script headers: internal_error.html.

How can I configure Passenger to find the Python modules installed in my virtualenv?

Try add your virtualenv site-packages on your sys.path after you change your INTERP.

import sys
sys.path.insert(0, '/path/to/venv/site-packages')

this is working with me

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM