我正在使用Django / Python 2.7测试OpenShift,我得到了这个:
127.5.232.1 - - [2013-06-28 17:01:37] "GET / HTTP/1.1" 500 161 0.013770
Traceback (most recent call last):
File "build/bdist.linux-x86_64/egg/gevent/pywsgi.py", line 438, in handle_one_response
self.run_application()
File "build/bdist.linux-x86_64/egg/gevent/pywsgi.py", line 424, in run_application
self.result = self.application(self.environ, self.start_response)
File "/var/lib/openshift/51cd757de0b8cd31130000c1/python/virtenv/lib/python2.7/site-packages/Django-1.5.1-py2.7.egg/django/core/handlers/wsgi.py", line 236, in __call__
self.load_middleware()
File "/var/lib/openshift/51cd757de0b8cd31130000c1/python/virtenv/lib/python2.7/site-packages/Django-1.5.1-py2.7.egg/django/core/handlers/base.py", line 45, in load_middleware
for middleware_path in settings.MIDDLEWARE_CLASSES:
File "/var/lib/openshift/51cd757de0b8cd31130000c1/python/virtenv/lib/python2.7/site-packages/Django-1.5.1-py2.7.egg/django/conf/__init__.py", line 53, in __getattr__
self._setup(name)
File "/var/lib/openshift/51cd757de0b8cd31130000c1/python/virtenv/lib/python2.7/site-packages/Django-1.5.1-py2.7.egg/django/conf/__init__.py", line 48, in _setup
self._wrapped = Settings(settings_module)
File "/var/lib/openshift/51cd757de0b8cd31130000c1/python/virtenv/lib/python2.7/site-packages/Django-1.5.1-py2.7.egg/django/conf/__init__.py", line 134, in __init__
raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
ImportError: Could not import settings 'www_project.settings' (Is it on sys.path?): No module named openshiftlibs
<WSGIServer fileno=6 address=127.5.232.1:8080>: Failed to handle request:
request = GET /favicon.ico HTTP/1.1 from ('127.5.232.1', 22073)
application = <django.core.handlers.wsgi.WSGIHandler object at 0x7f65c45dc510>
我做了什么?:
这是我的申请文件:
#!/usr/bin/env python
import os
import sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'www_project.settings'
sys.path.append(os.path.join(os.environ['OPENSHIFT_REPO_DIR'], 'wsgi', 'www_project'))
virtenv = os.environ['OPENSHIFT_REPO_DIR'] + '/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:
pass
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
我的问题:
我缺少什么?,如果您需要别的东西,请告诉我。提前谢谢!
答案 0 :(得分:1)
我错过了openshiftlibs.py文件
答案 1 :(得分:0)
我遇到了这个问题并用这篇文章解决了它
http://appsembler.com/blog/django-deployment-using-openshift/
答案 2 :(得分:0)