paperless-ngx/src/paperless/urls.py

50 lines
1.5 KiB
Python
Raw Normal View History

2015-12-20 19:23:33 +00:00
from django.conf import settings
2018-01-06 18:51:10 +00:00
from django.conf.urls import include, static, url
2015-12-20 19:23:33 +00:00
from django.contrib import admin
from rest_framework.authtoken import views
2016-02-16 09:28:34 +00:00
from rest_framework.routers import DefaultRouter
from paperless.views import FaviconView
2016-02-16 09:28:34 +00:00
from documents.views import (
2018-01-06 18:51:10 +00:00
CorrespondentViewSet,
DocumentViewSet,
LogViewSet,
2018-09-05 15:25:14 +02:00
TagViewSet,
DocumentTypeViewSet,
SearchView,
IndexView
2018-09-25 16:09:33 +02:00
)
2016-02-16 09:28:34 +00:00
api_router = DefaultRouter()
api_router.register(r"correspondents", CorrespondentViewSet)
api_router.register(r"document_types", DocumentTypeViewSet)
api_router.register(r"documents", DocumentViewSet)
api_router.register(r"logs", LogViewSet)
api_router.register(r"tags", TagViewSet)
2016-01-01 16:13:59 +00:00
2015-12-20 19:23:33 +00:00
urlpatterns = [
2016-02-21 00:14:50 +00:00
# API
url(r"^api/auth/",include(('rest_framework.urls', 'rest_framework'), namespace="rest_framework")),
url(r"^api/search/", SearchView.as_view(), name="search"),
url(r"^api/token/", views.obtain_auth_token), url(r"^api/", include((api_router.urls, 'drf'), namespace="drf")),
# Favicon
url(r"^favicon.ico$", FaviconView.as_view(), name="favicon"),
2016-02-21 00:14:50 +00:00
# The Django admin
2016-03-03 18:18:38 +00:00
url(r"admin/", admin.site.urls),
2018-01-06 18:51:16 +00:00
# Root of the Frontent
url(r".*", IndexView.as_view()),
2016-02-21 00:14:50 +00:00
2015-12-20 19:23:33 +00:00
] + static.static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
2016-02-08 23:46:16 +00:00
# Text in each page's <h1> (and above login form).
admin.site.site_header = 'Paperless'
# Text at the end of each page's <title>.
admin.site.site_title = 'Paperless'
# Text at the top of the admin index page.
admin.site.index_title = 'Paperless administration'