urls.py 1.18 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 9
from django.contrib import admin

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

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


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

luxcem's avatar
luxcem committed
21 22
urlpatterns = [
    url(r"^admin/", admin.site.urls),
23 24
    url(r'^i18n/', include('django.conf.urls.i18n')),

luxcem's avatar
luxcem committed
25
    url(r"^api/", include(router.urls, namespace="api")),
26
    url(r"^feeds/", include("rp.feeds.urls", namespace="feeds")),
27 28
    url(r"^rp/", include("rp.urls", namespace="rp")),
    url(r'^accounts/', include('allauth.urls')),
29 30
    url(r"^users/", include('userprofile.urls', namespace="users")),
    url(r"^docs/api/", include_docs_urls(title="API de la revue de presse")),
luxcem's avatar
luxcem committed
31
]
32 33 34 35 36 37 38

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

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