-1

这是我的 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。我做错了什么?

4

1 回答 1

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()
于 2012-09-13T16:01:20.680 回答