2

I am trying to deploy a django website using apache2.4, mod_wsgi on ubuntu 14.04. The problem is that my wsgi.py file is unable to import django. this obviously means that i have not set python path for the virtualenv. But i am a little confused as to how to add python path of virtuaenv's site-packages. my wsgi.py is:

import os
import sys

sys.path.append('/home/sp/webapps')
sys.path.append('/home/sp/webapps/ilog_dev')

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ilog_dev.settings")

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

so the question is how should i add the virtualenv's site-package to python path

1

1 Answer 1

1

Have you tried path/to/virtualenv/activate before doing anything? Or maybe you didn't use virtualenv's python instead of global python.

Sign up to request clarification or add additional context in comments.

2 Comments

You can't use the 'activate' command line script with Apache/mod_wsgi easily as you generally don't have ability to change the scripts that startup Apache.
yes as the answer suggested, i only had to add this line sys.path.append('/path/to/my/venv/')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.