0

I'm using Django 1.8, and I can't access the admin panel anymore. Here's the error :

Reverse for 'app_list' with arguments '()' and keyword arguments '{'app_label': 'my_app'}' not found. 0 pattern(s) tried: []`

my_app is a custom app I created, and it is inside the INSTALLED_APPS. I tried to remove it from there, remove the app folder as well.

It's not always the same app that is not found, sometimes it's another custom app, sometimes it's Django auth app, or a third party app, it's really random.

Here's the traceback (http://dpaste.com/2W7MJV7):

Traceback:
File "/usr/local/lib/python3.4/site-packages/django/core/handlers/base.py" in get_response
  132.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python3.4/site-packages/django/contrib/admin/sites.py" in wrapper
  254.                 return self.admin_view(view, cacheable)(*args, **kwargs)
File "/usr/local/lib/python3.4/site-packages/django/utils/decorators.py" in _wrapped_view
  110.                     response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python3.4/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  57.         response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python3.4/site-packages/django/contrib/admin/sites.py" in inner
  233.             return view(request, *args, **kwargs)
File "/usr/local/lib/python3.4/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  57.         response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python3.4/site-packages/django/contrib/admin/sites.py" in index
  438.                                 current_app=self.name,
File "/usr/local/lib/python3.4/site-packages/django/core/urlresolvers.py" in reverse
  579.     return force_text(iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs)))
File "/usr/local/lib/python3.4/site-packages/django/core/urlresolvers.py" in _reverse_with_prefix
  496.                              (lookup_view_s, args, kwargs, len(patterns), patterns))

Exception Type: NoReverseMatch at /admin/
Exception Value: Reverse for 'app_list' with arguments '()' and keyword arguments '{'app_label': 'ttn'}' not found. 0 pattern(s) tried: []

Here's the main urls.py file :

from django.conf.urls import include, url
from django.core.urlresolvers import reverse_lazy
from django.contrib.auth.decorators import login_required
from django.contrib import admin
from django.views.generic import TemplateView, RedirectView


urlpatterns = [
    # apps
    url(r'', include('ttn.urls', namespace='ttn')),

    # admin panel
    url(r'^admin/', include(admin.site.urls)),
]
knbk
  • 52,111
  • 9
  • 124
  • 122
Dorian Amouroux
  • 157
  • 2
  • 15
  • Can you show the full traceback? – knbk Jul 21 '16 at 13:43
  • Could you please post your urls.py file content? – Jean Jung Jul 21 '16 at 13:49
  • I just edit my post – Dorian Amouroux Jul 21 '16 at 13:52
  • @Sayse While it's great to have a canonical answer, please don't get overzealous in closing every question as a duplicate if the deeper issue in the question is not entirely clear. In this case it could be more of an issue with the admin than with urls in itself, since the url for `app_list` is both included and reversed by built-in Django code. – knbk Jul 21 '16 at 13:53
  • Have you checked your `ROOT_URLCONF` setting? – Jean Jung Jul 21 '16 at 13:59
  • @knbk - The point of a canonical question/answer is to be used to explain a common issue, this becomes especially true on questions that are very vague with their description. There is nothing to be gained by having hundreds of questions all with the same answer, which is why I wrote that answer as a way for people to learn what the error is actually telling them and how to solve it – Sayse Jul 21 '16 at 13:59
  • @Sayse That's great, and many question fit the exact bill, but not every question about `NoReverseMatch` can be fixed with general advice about how urls work. In particular, I don't think this question fits the bill at all, since both the urlpatterns and the call to `reverse()` are defined by the built-in admin code, so there's obviously some issue going on that your answer doesn't touch on. – knbk Jul 21 '16 at 14:06
  • @knbk - I disagree but anywho, I intend to keep it updated If I ever see other things that have caused it.. either way [a simple google search for "NoReverseMatch at /admin/ app_list"](https://www.google.co.uk/search?q=NoReverseMatch+at+%2Fadmin%2F&rlz=1C1CHBF_en-GBGB700GB700&oq=NoReverseMatch+at+%2Fadmin%2F&aqs=chrome..69i57j0j69i60l2j0l2.279j0j7&sourceid=chrome&ie=UTF-8#q=NoReverseMatch+at+/admin/+app_list) returns multiple other duplicates. – Sayse Jul 21 '16 at 14:08
  • I've never touched my `ROOT_URLCONF` setting. All the website works well beside the admin panel. – Dorian Amouroux Jul 21 '16 at 14:08
  • Ok, it's fixed, apparently, the `debug_toolbar` app must not be declared before `django.contrib.admin`. – Dorian Amouroux Jul 21 '16 at 14:14
  • 1
    [From the second link in that google search](http://stackoverflow.com/a/28922918/1324033).. [django debug toolbar broke the admin?](http://stackoverflow.com/q/23287869/1324033) – Sayse Jul 21 '16 at 14:15
  • 1
    @Sayse This is exactly what I mean. The problem here is caused by an error in the OP's settings, not by any of the issues described in your answer. It is of course a duplicate, but it's not a duplicate of your canonical answer. – knbk Jul 21 '16 at 14:18
  • @knbk - I've updated that canonical to include an extra sentence based on this question. IMO, any time a duplicate is suggested, the OP gets a notice to tell them to look at the duplicate, see if it helps, and if not edit their question to include what they have tried further and to further describe their problem - which is what should have happened here. In case it wasn't clear though, I do respect your comments and input – Sayse Jul 21 '16 at 14:22
  • @DorianAmouroux I was thinking about a renamed app or something like that. It's good that you have discovered the issue (: – Jean Jung Jul 21 '16 at 14:22

0 Answers0