I'm testing OpenShift with Django/Python 2.7 and I'm getting this:
我用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>
What I did?:
我所做的吗?
- Created an application using rhc command line tool
- 使用rhc命令行工具创建应用程序
- Created an "isolated Django application" and copied into the wsgi directory
- 创建了一个“孤立的Django应用程序”并复制到wsgi目录中。
- Replaced the application and settings file for the official django example
- 替换了官方django示例的应用程序和设置文件
- Pushed and tried
- 推,
This is my application file:
这是我的申请文件:
#!/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()
My question:
我的问题:
What am I missing?, if you need something else please let me know. Thanks in advance!
我缺少什么?如果你需要什么,请告诉我。提前谢谢!
3 个解决方案
#1
1
I was missing the openshiftlibs.py file
我错过了openshiftlibs。py文件
#2
0
I had that problem and solved it with this post
我有那个问题,用这篇文章解决了
http://appsembler.com/blog/django-deployment-using-openshift/
http://appsembler.com/blog/django-deployment-using-openshift/
#3
0
It appears you are missing dependency, see this KB and forum article on how to get pass the issue.
看起来您缺少依赖项,请参阅关于如何通过这个问题的知识库和论坛文章。
https://www.openshift.com/forums/express/importerror-no-module-named-djangocoremanagement-after-your-last-maintenance评论形式
https://www.openshift.com/kb/kb-e1064-python-app-still-throws-importerror-no-module-named-xyz-even-though-ive-configured
#1
1
I was missing the openshiftlibs.py file
我错过了openshiftlibs。py文件
#2
0
I had that problem and solved it with this post
我有那个问题,用这篇文章解决了
http://appsembler.com/blog/django-deployment-using-openshift/
http://appsembler.com/blog/django-deployment-using-openshift/
#3
0
It appears you are missing dependency, see this KB and forum article on how to get pass the issue.
看起来您缺少依赖项,请参阅关于如何通过这个问题的知识库和论坛文章。
https://www.openshift.com/forums/express/importerror-no-module-named-djangocoremanagement-after-your-last-maintenance评论形式
https://www.openshift.com/kb/kb-e1064-python-app-still-throws-importerror-no-module-named-xyz-even-though-ive-configured