paperless-ngx/src/paperless/urls.py

57 lines
1.8 KiB
Python
Raw Normal View History

2015-12-20 19:23:33 +00:00
"""paperless URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
Including another URLconf
1. Add an import: from blog import urls as blog_urls
2. Import the include() function: from django.conf.urls import url, include
3. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls))
"""
from django.conf import settings
2016-02-16 09:28:34 +00:00
from django.conf.urls import url, static, include
2015-12-20 19:23:33 +00:00
from django.contrib import admin
2016-02-16 09:28:34 +00:00
from rest_framework.routers import DefaultRouter
from documents.views import (
2016-03-03 18:09:10 +00:00
IndexView, FetchView, PushView,
SenderViewSet, TagViewSet, DocumentViewSet, LogViewSet
2016-03-01 19:03:28 +00:00
)
2016-02-16 09:28:34 +00:00
router = DefaultRouter()
router.register(r'senders', SenderViewSet)
router.register(r'tags', TagViewSet)
router.register(r'documents', DocumentViewSet)
2016-03-01 18:57:12 +00:00
router.register(r'logs', LogViewSet)
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/",
2016-02-21 00:55:38 +00:00
include('rest_framework.urls', namespace="rest_framework")
2016-02-21 00:14:50 +00:00
),
2016-02-21 00:55:38 +00:00
url(r"^api/", include(router.urls, namespace="drf")),
2016-02-21 00:14:50 +00:00
2016-03-03 18:09:10 +00:00
# Normal pages (coming soon)
# url(r"^$", IndexView.as_view(), name="index"),
2016-02-21 00:14:50 +00:00
# File downloads
url(r"^fetch/(?P<pk>\d+)$", FetchView.as_view(), name="fetch"),
2016-02-21 00:14:50 +00:00
# The Django admin
2016-03-03 18:09:10 +00:00
url(r"admin", admin.site.urls),
url(r"", admin.site.urls), # This is going away
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
if settings.SHARED_SECRET:
2016-02-08 23:46:16 +00:00
urlpatterns.insert(0, url(r"^push$", PushView.as_view(), name="push"))