这是我的wsgi文件的内容:
import os
import sys
# put virtual environment on sys.path
sys.path.append("/check/www/pyapps/lib/python2.7/site-packages")
# put the Django project on sys.path
#sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../../")))
sys.path.append("/check/www/")
sys.path.append("/check/www/textpisodes")
os.environ['DJANGO_SETTINGS_MODULE'] = 'textpisodes.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
我创建了一个基本的pinax帐户项目,我正在尝试使用apache和mod_wsgi。但我得到的只是TemplateSyntaxError: Caught ImportError while rendering: No module named about
。我做错了什么?
答案 0 :(得分:0)
您可以在我的网站上使用此代码。希望能帮到你!
#!/usr/bin/python
import os, site, sys
# add the virtual environment path
site.addsitedir('/home/admin/webapps/djangotest/env/lib/python2.7/site-packages') # if you are using virtualenv
site.addsitedir('/home/admin/webapps/djangotest/django_project')
site.addsitedir('/home/admin/webapps/djangotest')
# fix markdown.py (and potentially others) using stdout
sys.stdout = sys.stderr
#Calculate the path based on the location of the WSGI script.
project = os.path.dirname(__file__)
workspace = os.path.dirname(project)
sys.path.append(workspace)
os.environ['PYTHON_EGG_CACHE'] = '/tmp'
os.environ['DJANGO_SETTINGS_MODULE'] = 'django_project.settings'
from django.core.handlers.wsgi import WSGIHandler
application = WSGIHandler()