urls.py 1.28 KB
Newer Older
luxcem's avatar
luxcem committed
1
2
3
"""
rp_new URL Configuration
"""
luxcem's avatar
luxcem committed
4

5
from django.conf import settings
luxcem's avatar
luxcem committed
6
from django.conf.urls import url, include
7
from django.conf.urls.static import static
luxcem's avatar
luxcem committed
8
from django.contrib import admin
9
from django.views.generic.base import RedirectView
luxcem's avatar
luxcem committed
10

luxcem's avatar
luxcem committed
11
12
13
14
# Django rest framework router
from core.routers import DefaultRouter
from rp.api.urls import router as rp_router

15
16
17
18
# Django rest framework documentation
from rest_framework.documentation import include_docs_urls


luxcem's avatar
luxcem committed
19
20
21
router = DefaultRouter()
router.extend(rp_router)

luxcem's avatar
luxcem committed
22
23
urlpatterns = [
    url(r"^admin/", admin.site.urls),
24
    url(r'^$', RedirectView.as_view(url='/rp/', permanent=False), name='index'),
25
    url(r'^i18n/', include('django.conf.urls.i18n')),
26
27
28
    url(r"^api/", include((router.urls, "api"))),
    url(r"^feeds/", include(("rp.feeds.urls", "feeds"))),
    url(r"^rp/", include(("rp.urls", "rp"))),
29
    url(r'^accounts/', include('allauth.urls')),
30
    url(r"^users/", include(('userprofile.urls', "users"))),
31
    url(r"^docs/api/", include_docs_urls(title="API de la revue de presse")),
luxcem's avatar
luxcem committed
32
]
33
34
35
36
37
38
39

if settings.DEBUG:
    # Serve static files in DEBUG mode
    urlpatterns += static(
        settings.MEDIA_URL,
        document_root=settings.MEDIA_ROOT
    )
40
41
42
43
44

    import debug_toolbar
    urlpatterns += [
        url(r'^__debug__/', include(debug_toolbar.urls)),
    ]