我尝试在项目文件夹中使用 wsgi.py 配置WSGI
import os
import sys
sys.path.append(os.path.join(os.environ['OPENSHIFT_REPO_DIR']))
os.environ['DJANGO_SETTINGS_MODULE'] = 'project.settings'
virtenv = os.environ['OPENSHIFT_HOMEDIR'] + 'python/virtenv/'
os.environ['PYTHON_EGG_CACHE'] = os.path.join(virtenv, 'lib/python2.7/site-packages')
virtualenv = os.path.join(virtenv, 'bin/activate_this.py')
try:
execfile(virtualenv, dict(__file__=virtualenv))
except IOError:
pass
#
# IMPORTANT: Put any additional includes below this line. If placed above this
# line, it's possible required libraries won't be in your searchable path
#
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
但我有内部服务器错误500
[Wed Jun 08 16:42:46 2016] [error] [client 127.9.155.129] ImportError: No module named project.settings
我在我的项目中有这个模块。
我尝试了一些帮助:
你能帮助我在OpenShift上启动我的应用
由于
答案 0 :(得分:0)
我位于 wsgi.py
的顶部os.path.join(os.environ['OPENSHIFT_HOMEDIR'], 'app-root/repo')
我没有这个错误! 我还将所有代码放在具有项目名称的文件夹下以匹配
os.environ['DJANGO_SETTINGS_MODULE'] = 'project.settings'