首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Django: ImportError:没有名为quiz.views的模块

Django: ImportError:没有名为quiz.views的模块
EN

Stack Overflow用户
提问于 2013-05-24 08:12:12
回答 1查看 1.3K关注 0票数 2

我正在尝试将我的应用程序部署到OpenShift上,但我遇到了一些麻烦。我尝试将我的文件添加到默认的django-example项目中,这就是我得到的(我的应用程序在'quiz‘文件夹中,从本地项目复制):

来自settings.py:

代码语言:javascript
复制
INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'quiz', 
    ...

ROOT_URLCONF = 'quiz.urls'

来自urls.py:

代码语言:javascript
复制
from django.conf.urls import patterns, include, url
from quiz.views import *

# Uncomment the next two lines to enable the admin:
from django.contrib import admin

admin.autodiscover()

urlpatterns = patterns('',
                       ('^$', main_default), # default page 
                       ...

在集成开发环境中,当我在本地主机上启动应用程序时,一切看起来都很好,但当我将其部署到OpenShift时,我看到了500内部错误和日志消息(来自rhc tail customerquiz):

代码语言:javascript
复制
==> python-2.6/logs/error_log-20130524-000000-EST <==
[Thu May 23 20:10:36 2013] [error] /var/lib/openshift/519e94cb4382ec04d50000e7/python-2.6/virtenv/lib/python2.6/site-packages/Django-1.4-py2.6.egg/django/conf/__init__.py:75: DeprecationWarning: The ADMIN_MEDIA_PREFIX setting has been removed; use STATIC_URL instead.
[Thu May 23 20:10:36 2013] [error]   "use STATIC_URL instead.", DeprecationWarning)
[Thu May 23 20:10:36 2013] [error] [client 127.9.99.129] mod_wsgi (pid=29603): Exception occurred processing WSGI script '/var/lib/openshift/519e94cb4382ec04d50000e7/app-root/runtime/repo/wsgi/application'.
[Thu May 23 20:10:36 2013] [error] [client 127.9.99.129] Traceback (most recent call last):
[Thu May 23 20:10:36 2013] [error] [client 127.9.99.129]   File "/var/lib/openshift/519e94cb4382ec04d50000e7/python-2.6/virtenv/lib/python2.6/site-packages/Django-1.4-py2.6.egg/django/core/handlers/wsgi.py", line 241, in __call__
[Thu May 23 20:10:36 2013] [error] [client 127.9.99.129]     response = self.get_response(request)
[Thu May 23 20:10:36 2013] [error] [client 127.9.99.129]   File "/var/lib/openshift/519e94cb4382ec04d50000e7/python-2.6/virtenv/lib/python2.6/site-packages/Django-1.4-py2.6.egg/django/core/handlers/base.py", line 179, in get_response
[Thu May 23 20:10:36 2013] [error] [client 127.9.99.129]     response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
[Thu May 23 20:10:36 2013] [error] [client 127.9.99.129]   File "/var/lib/openshift/519e94cb4382ec04d50000e7/python-2.6/virtenv/lib/python2.6/site-packages/Django-1.4-py2.6.egg/django/core/handlers/base.py", line 224, in handle_uncaught_exception
[Thu May 23 20:10:36 2013] [error] [client 127.9.99.129]     if resolver.urlconf_module is None:
[Thu May 23 20:10:36 2013] [error] [client 127.9.99.129]   File "/var/lib/openshift/519e94cb4382ec04d50000e7/python-2.6/virtenv/lib/python2.6/site-packages/Django-1.4-py2.6.egg/django/core/urlresolvers.py", line 323, in urlconf_module
[Thu May 23 20:10:36 2013] [error] [client 127.9.99.129]     self._urlconf_module = import_module(self.urlconf_name)
[Thu May 23 20:10:36 2013] [error] [client 127.9.99.129]   File "/var/lib/openshift/519e94cb4382ec04d50000e7/python-2.6/virtenv/lib/python2.6/site-packages/Django-1.4-py2.6.egg/django/utils/importlib.py", line 35, in import_module
[Thu May 23 20:10:36 2013] [error] [client 127.9.99.129]     __import__(name)
[Thu May 23 20:10:36 2013] [error] [client 127.9.99.129] ImportError: No module named quiz.urls

有什么想法,我被宠坏了吗?

EN

回答 1

Stack Overflow用户

发布于 2013-05-26 10:47:44

这篇由Nate http://appsembler.com/blog/django-deployment-using-openshift/撰写的文章应该可以帮助你正确地规划你的项目。

您不能像在OpenShift上一样在本地计算机上对它们进行布局。我们正在努力让它变得更加透明,但现在你需要做一些调整。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16725903

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档