D
D
Dmitry2015-03-13 21:47:15
Django
Dmitry, 2015-03-13 21:47:15

All urls stopped working in django after installing allauth, now all urls are only from allauth, how to fix it?

Actually the question is in the title. Now the urls of other applications do not work, as I understand it allauth overrides all routers? How to return the old behavior of django?
main router:

from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static
from django.contrib.staticfiles.urls import staticfiles_urlpatterns


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

    #
    url(r'^grappelli/', include('grappelli.urls')), # grappelli URLS
    url(r'^admin/',  include(admin.site.urls)),
    url(r'^блог/', include('blog.urls')),
    url(r'^accounts/', include('allauth.urls')),
    url(r'^', include('portal.urls')),  #@TODO не работают все урлы кроме allauth

)+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)


urlpatterns += staticfiles_urlpatterns()
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
if settings.DEBUG:
    import debug_toolbar
    urlpatterns += patterns('',
        url(r'^__debug__/', include(debug_toolbar.urls)),
    )

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
George, 2015-03-14
@BATC0H

I compare your router with almost the same on my project (where allauth is also and everything is ok).
Thinking out loud, too lazy to check.
0) What providers for allauth are used? Are there any of them that are not included in the standard delivery?
allauth.urls imports .urls from each connected provider, perhaps one of them is misspelled.
1) For Cyrillic to work, you should probably specify the encoding if python 2.x is used
Well, like
# -*- coding: utf-8 -*-
at the beginning of the file. This is about r'^blog/'
2) What version of Django do you have?
You didn't overdo it with statics, did you? By default, with DEBUG=True in current versions of Django, static is processed for runserver automatically and you do not need to put it in urls. And with DEBUG=False, it should be handled by the web server, not the Django application.
If you have some kind of overridden runserver that does NOT support static, then you really need a separate route for it.
But in this case, the line
urlpatterns += staticfiles_urlpatterns()
is similar to the line
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
and you need to leave one (most likely the first one).
3) check that all applications used in the router are present in settings.INSTALLED_APPS

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question