1

I have a little test project on which I always install and test package prior to my dev apps. Since I installed the django debug toolbar on it, I'm having the following error message when connecting to the admin site ( the other urls are fine ):

NoReverseMatch at /admin/
Reverse for 'app_list' with arguments '()' and keyword arguments '{'app_label': 'auth'}' not found. 0 pattern(s) tried: []
Request Method: GET
Request URL:    http://127.0.0.1:8000/admin/
Django Version: 1.8
Exception Type: NoReverseMatch
Exception Value:    
Reverse for 'app_list' with arguments '()' and keyword arguments '{'app_label': 'auth'}' not found. 0 pattern(s) tried: []
Exception Location: C:\Anaconda\lib\site-packages\django-1.8-py2.7.egg\django\core\urlresolvers.py in _reverse_with_prefix, line 436
Python Executable:  C:\Anaconda\python.exe
Python Version: 2.7.6
Python Path:    
['C:\\Users\\ut1u3h\\test_project',
 'C:\\Anaconda\\lib\\site-packages\\django-1.8-py2.7.egg',
 'C:\\Anaconda\\lib\\site-packages\\django_rosetta-0.7.5-py2.7.egg',
 'C:\\Anaconda\\lib\\site-packages\\django_debug_toolbar-1.1-py2.7.egg',
 'C:\\Anaconda\\lib\\site-packages\\sqlparse-0.1.11-py2.7.egg',
 'C:\\Anaconda\\python27.zip',
 'C:\\Anaconda\\DLLs',
 'C:\\Anaconda\\lib',
 'C:\\Anaconda\\lib\\plat-win',
 'C:\\Anaconda\\lib\\lib-tk',
 'C:\\Anaconda',
 'c:\\anaconda\\lib\\site-packages\\setuptools-2.2-py2.7.egg',
 'C:\\Anaconda\\lib\\site-packages',
 'C:\\Anaconda\\lib\\site-packages\\PIL',
 'C:\\Anaconda\\lib\\site-packages\\win32',
 'C:\\Anaconda\\lib\\site-packages\\win32\\lib',
 'C:\\Anaconda\\lib\\site-packages\\Pythonwin']
Server time:    Fri, 25 Apr 2014 10:13:32 +0000

this is my settings.py file

"""
Django settings for test_project project.

For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(__file__)


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/dev/howto/deployment/checklist/

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['localhost', '127.0.0.1']
TEMPLATE_DEBUG = True

ALLOWED_HOSTS = ['*']
TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')]

# Application definition

INSTALLED_APPS = (

    'debug_toolbar',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'polls',
    'rosetta',
)

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

ROOT_URLCONF = 'test_project.urls'

WSGI_APPLICATION = 'test_project.wsgi.application'


# Database
# https://docs.djangoproject.com/en/dev/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}

# Internationalization
# https://docs.djangoproject.com/en/dev/topics/i18n/

LANGUAGE_CODE = 'en-us'

LANGUAGES = (
    ('fr', 'French'),
    ('en-us', 'English'),
)

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True
LOCALE_PATHS = (os.path.join(BASE_DIR, '../locale/'),)

ROSETTA_STORAGE_CLASS = 'rosetta.storage.CacheRosettaStorage'

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/dev/howto/static-files/

STATIC_URL = '/static/'
SITE_ROOT = os.path.dirname(os.path.realpath(__file__))
STATICFILES_DIRS = (
  os.path.join(SITE_ROOT, 'static/'),
)

TEMPLATE_CONTEXT_PROCESSORS = ( 
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.contrib.auth.context_processors.auth" )

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',
    'debug_toolbar.panels.redirects.RedirectsPanel',
]

INTERNAL_IPS = ('127.0.0.1',)

and my urls.py looks like this:

urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'test_project.views.home', name='home'),
    # url(r'^blog/', include('blog.urls')),

    url(r'^admin/', include(admin.site.urls)),
    url(r'^rosetta/', include('rosetta.urls')),

)
urlpatterns += i18n_patterns('', url(r'^$', views.home),)
4

2 回答 2

5

As Luca pointed out, this can be caused by an incorrect ordering of your INSTALLED_APPS setting. 'debug_toolbar.apps.DebugToolbarConfig' must come after 'django.contrib.staticfiles', as shown in the docs.

于 2015-03-08T04:00:09.660 回答
1

如 django-debug-toolbar README [1] 中所述,仅支持最高 1.7 的 Django;根据您的帖子,您使用的是 Django 1.8,该版本处于早期开发阶段且不稳定。简单的降级应该可以解决问题。

[1] https://github.com/django-debug-toolbar/django-debug-toolbar

于 2014-04-25T12:23:35.453 回答