SORU
7 Ocak 2014, Salı


İmproperlyConfigured: dahil urlconf <proje>.'t herhangi bir desen var bu URL değil

Bir django (1.6.x) Ubuntu üzerine dev sunucu ile iyi çalışır, ama Apache2 altında başarısız proje (2.2.22.1) ve mod_wsgi (3.3-4) hata ile 12.04.3

İmproperlyConfigured: dahil urlconf kullanıcı mevcut.URL içinde herhangi bir desen yok

Dev server ama Apache2/mod_wsgi ile çalışmak istiyorsunuz anlamıyorum ve zor hata nereden geldiğini izini buluyorum.

Sorular benzer başka bir dizi var, ama kullandığım tek yer ters (bir sorun daha önce bulunan) benim modellerde get_absolute_url - bu iyi olmalı?

Proje la İki Kepçe tarzı bir dizi, özellikle düzeni:

<repository_root>/<django_project_root>/<configuration_root>/

çeviren:

erp_root/erp/erp/

ve ayarları

8* *(__init__.py da dahil olmak üzere)

erp/urls.py;

from django.conf import settings
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    url(r'^$', 'django.contrib.auth.views.login', {'template_name': 'login.html'}),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^login/$', 'django.contrib.auth.views.login', {'template_name': 'login.html'}, name='login'),
    url(r'^logout/$', 'django.contrib.auth.views.logout_then_login', {}, name='logout'),
    url(r'^search/', include('haystack.urls')),
    url(r'^inventory/', include('inventory.urls')),
)

if settings.DEBUG:
    import debug_toolbar
    urlpatterns  = patterns('',
    url(r'^__debug__/', include(debug_toolbar.urls)),
)

ve inventory/urls.py:

from django.conf.urls import url, patterns
from .forms import CarrierWizardForm1, CarrierWizardForm2, MovementWizardForm1,MovementWizardForm2
from . import views

carrier_wizard_forms = [CarrierWizardForm1, CarrierWizardForm2]
movement_wizard_forms = [MovementWizardForm1, MovementWizardForm2]

urlpatterns = patterns('',
    url(r'^$', views.PartNumberListView.as_view(), name='inventory_list_index'),
    url(r'^parttype/$', views.part_type_list, name='index'),
    url(r'^parttype/(?P<parttype>\d{2})/$', views.part_type_view, name='part_type_view'),
    url(r'^partnumber/$', views.PartNumberListView.as_view(), name='partnumber_list'),
    url(r'^partnumber/add/$', views.PartNumberCreateView.as_view(), name='partnumber_add'),
    url(r'^partnumber/(?P<slug>[-\w] )/$', views.PartNumberView.as_view(), name='partnumber_view'),
    url(r'^partnumber/(?P<slug>[-\w] )/update/$', views.PartNumberUpdateView.as_view(), name='partnumber_update'),
    url(r'^partnumber/(?P<slug>[-\w] )/delete/$', views.PartNumberDeleteView.as_view(), name='partnumber_delete'),
    ....
       )

ve erp/settings/dev.py:

# Django settings for erp project.
# settings.py

from unipath import Path

PROJECT_DIR = Path(__file__).ancestor(3)
MEDIA_ROOT = PROJECT_DIR.child("media")
STATIC_ROOT = PROJECT_DIR.child("static")
STATICFILES_DIRS = (
  PROJECT_DIR.child("assets"),
)
TEMPLATE_DIRS = (
  PROJECT_DIR.child("templates"),
)


DEBUG = True
TEMPLATE_DEBUG = DEBUG

TIME_ZONE = 'Australia/Melbourne'
LANGUAGE_CODE = 'en-au'
SITE_ID = 1
USE_TZ = True

DATE_FORMAT = 'd/m/y'
SHORT_DATE_FORMAT = 'd/m/y'

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://example.com/media/", "http://media.example.com/"
MEDIA_URL = ''

# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/var/www/example.com/static/"
STATIC_ROOT = ''

# URL prefix for static files.
# Example: "http://example.com/static/", "http://static.example.com/"
STATIC_URL = '/static/'

STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
)

MIDDLEWARE_CLASSES = (
    'debug_toolbar.middleware.DebugToolbarMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'stronghold.middleware.LoginRequiredMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

ROOT_URLCONF = 'erp.urls'

# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'erp.wsgi.application'


INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.admin',
    'django.contrib.formtools',
    'django.contrib.humanize',
    'inventory',
    'django_extensions',
    'extra_views',
    'debug_toolbar',
    'django_tables2',
    'stronghold',
    'bootstrap3',
    'haystack',
)

LOGIN_URL = '/login'
LOGOUT_URL = '/logout'

# For Stronghold
STRONGHOLD_PUBLIC_NAMED_URLS = (
    'login',
    'logout',
)

# This is required by the debug toolbar middleware
INTERNAL_IPS = ('192.168.0.16','0.0.0.0','127.0.0.1','::1', '192.168.0.115')

# This is reqquired by django_tables2
TEMPLATE_CONTEXT_PROCESSORS = ("django.contrib.auth.context_processors.auth",
                           "django.core.context_processors.debug",
                           "django.core.context_processors.i18n",
                           "django.core.context_processors.media",
                           "django.core.context_processors.static",
                           "django.core.context_processors.tz",
                           "django.contrib.messages.context_processors.messages",
                           "django.core.context_processors.request"
                          )
}

LOGIN_REDIRECT_URL = '/inventory/'

DEBUG_TOOLBAR_PANELS = [
'debug_toolbar.panels.versions.VersionsPanel',
'debug_toolbar.panels.timer.TimerPanel',
'debug_toolbar.panels.settings.SettingsPanel',
'debug_toolbar.panels.headers.HeadersPanel',
'debug_toolbar.panels.request.RequestPanel',
'debug_toolbar.panels.sql.SQLPanel',
'debug_toolbar.panels.staticfiles.StaticFilesPanel',
'debug_toolbar.panels.templates.TemplatesPanel',
'debug_toolbar.panels.cache.CachePanel',
'debug_toolbar.panels.signals.SignalsPanel',
'debug_toolbar.panels.logging.LoggingPanel',
]

def show_toolbar(request):
    return True  # Always show toolbar, for example purposes only.

DEBUG_TOOLBAR_CONFIG = {
'INTERCEPT_REDIRECTS': False,
'INSERT_BEFORE': '</body>',
'ENABLE_STACKTRACES': True,
}

# This is required for Haystack - the search engine
HAYSTACK_CONNECTIONS = {
      'default': {
    'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
    'URL': 'http://127.0.0.1:8085/solr/erp',
  },
}

Benim wsgı küçük ayarlar mod: standart

import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "erp.settings.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

Apache2/sites-boşuna/benim sayabiliriz.conf:

<VirtualHost *:80>
   ServerName deverp
   ServerAdmin administrator
   DocumentRoot /path/www/dev/erp/erp/
   ErrorLog /var/log/apache2/dev/error.log
   CustomLog /var/log/apache2/dev/access.log combined
   WSGIDaemonProcess deverp python-path=/path/www/dev/erp/erp:/path/.virtualenvs/erp-dev/lib/python2.7/site-packages
   WSGIProcessGroup deverp
   WSGIScriptAlias / /path/www/dev/erp/erp/erp/wsgi.py
  <Directory /path/www/dev/erp/erp/erp>
  <Files wsgi.py>
    Order deny,allow
    Allow from all
  </Files>
  </Directory>
</VirtualHost>

CEVAP
8 Ocak 2014, ÇARŞAMBA


Yani, aslında ben de benzer bir sorun koştu. Sonra tesadüfen django-stronghold konularda gönderildi. Konu django-debug araç çubuğu eksik bir ayar yüzünden aslında.

Eksik ayarı:

DEBUG_TOOLBAR_PATCH_SETTINGS = False 

Runserver ile çalışacak, ama eğer şef, ya da gunicorn, ya WSGI arayüzü kullanan başka bir şey ile çalıştırmak için çalışırsanız patlar.

Bu yardımcı olur umarım!

EDİT: aşağıda @japhyr, kullanışlı açık kurulum talimatları kontrol etmek belirtildiği gibi: 17**

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Breno Rises

    Breno Rises

    7 Ocak 2014
  • emimusic

    emimusic

    10 Mart 2006
  • PaysNatalAu's channel

    PaysNatalAu'

    11 Aralık 2010