Django和Openshift - ImportError:没有名为settings的模块

时间:2016-07-30 18:05:15

标签: django openshift

我正在尝试在Django上写一个简单的Zinnia博客。我正在尝试部署它Openshift并在最后尝试识别此错误。我在上周迷失了这个!什么可能抛出这个错误?我正在检查我的Python路径,似乎没问题。 Git成功推送(Django 1.8,Python 2.7)

remote: Starting Python 2.7 cartridge (Apache+mod_wsgi)
remote: Application directory "wsgi/" selected as DocumentRoot
remote: $OPENSHIFT_PYTHON_WSGI_APPLICATION ENV VAR detected
remote: Application "wsgi/myproject/myproject/wsgi.py" selected as default WSGI entry point
remote: --> ACTION HOOK: post_deploy being done <--
remote: -------------------------
remote: Git Post-Receive Result: success
remote: Activation status: success
remote: Deployment completed with status: success

WSGI.py文件就像这样

import os import sys
from django.core.wsgi import get_wsgi_application

sys.path.append(os.path.join(os.environ['OPENSHIFT_REPO_DIR'], 'wsgi',   'myproject')) 
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myproject.settings")  
application = get_wsgi_application()

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

manage.py文件就像这样

import os
import sys

if __name__ == "__main__":
    # GETTING-STARTED: change 'myproject' to your project name:
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myproject.settings")

    from django.core.management import execute_from_command_line

    execute_from_command_line(sys.argv)

错误消息如下 -

==> app-root/logs/python.log <==
[Sat Jul 30 13:41:44 2016] [error] [client 127.7.219.129]   File      "/var/lib/openshift/5789ce167628e144ee000113/python/virtenv/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/conf/__init__.py", line 48, in __getattr__
[Sat Jul 30 13:41:44 2016] [error] [client 127.7.219.129]       self._setup(name)
[Sat Jul 30 13:41:44 2016] [error] [client 127.7.219.129]   File "/var/lib/openshift/5789ce167628e144ee000113/python/virtenv/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/conf/__init__.py", line 44, in _setup
[Sat Jul 30 13:41:44 2016] [error] [client 127.7.219.129]     self._wrapped = Settings(settings_module)
[Sat Jul 30 13:41:44 2016] [error] [client 127.7.219.129]   File  "/var/lib/openshift/5789ce167628e144ee000113/python/virtenv/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/conf/__init__.py", line 92, in __init__
[Sat Jul 30 13:41:44 2016] [error] [client 127.7.219.129]     mod = importlib.import_module(self.SETTINGS_MODULE)
[Sat Jul 30 13:41:44 2016] [error] [client 127.7.219.129]   File "/opt/rh/python27/root/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
[Sat Jul 30 13:41:44 2016] [error] [client 127.7.219.129]     __import__(name)
[Sat Jul 30 13:41:44 2016] [error] [client 127.7.219.129] ImportError: No  module named settings

任何帮助都会非常感激......这非常令人沮丧!

0 个答案:

没有答案