vendredi 14 novembre 2014

openshift - Django : ImportError : aucun module ne nommé quiz.views - Stack Overflow


I'm trying to deploy my app to the OpenShift, but I have some troubles. I tried to add my files to the default django-example project and that's what I've got (my app is in 'quiz' folder, copied from local project):


enter image description here


From settings.py:


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'

From urls.py:


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
...

In IDE everything looks fine, when I launch app on localhost - everything works perfectly, but when I deploy it to OpenShift - I see 500 Internal error and log message (from rhc tail customerquiz):


==> 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

Any ideas, where I spoiled?




This post by Nate http://appsembler.com/blog/django-deployment-using-openshift/ should help you lay out your project properly.


You can not lay them out the same on your local machine as you do for OpenShift. We are working on making this more transparent but for right now you need to do some tweaks.



I'm trying to deploy my app to the OpenShift, but I have some troubles. I tried to add my files to the default django-example project and that's what I've got (my app is in 'quiz' folder, copied from local project):


enter image description here


From settings.py:


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'

From urls.py:


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
...

In IDE everything looks fine, when I launch app on localhost - everything works perfectly, but when I deploy it to OpenShift - I see 500 Internal error and log message (from rhc tail customerquiz):


==> 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

Any ideas, where I spoiled?



This post by Nate http://appsembler.com/blog/django-deployment-using-openshift/ should help you lay out your project properly.


You can not lay them out the same on your local machine as you do for OpenShift. We are working on making this more transparent but for right now you need to do some tweaks.


0 commentaires:

Enregistrer un commentaire