aboutsummaryrefslogtreecommitdiff
path: root/config/base_urls.py
blob: 19d6499e31d864404157a6b632b33b05ace783ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
from django.contrib import admin
from django.urls import path
from django.views.generic.base import RedirectView
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.conf import settings

from django_registration.backends.activation.views import RegistrationView
from rest_framework import routers

from pages.views import PageDetailView
from accounts.forms import UserForm
from notes.views import (
    NoteViewSet,
    NotebookViewSet,
    NoteListView,
    TagViewSet,
)

# redirect admin as per Adrian holovaty's site
ADMIN_URL = 'https://docs.djangoproject.com/en/dev/ref/contrib/admin/'

router = routers.DefaultRouter()
router.register(r'notes/notebook', NotebookViewSet, basename="notebook-api")
router.register(r'notes', NoteViewSet, basename="notes-api")
router.register(r'tags', TagViewSet, basename="tags-api")


urlpatterns = static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += [
    path('admin/', RedirectView.as_view(url=ADMIN_URL)),
    path('magux/', admin.site.urls),
    path(r'accounts/', include('django_registration.backends.activation.urls')),
    path(r'accounts/', include('django.contrib.auth.urls')),
    path(r'register/', RegistrationView.as_view(form_class=UserForm), name='django_registration_register',),
    path(r'settings/', include('accounts.urls')),
    path(r'', include('django_registration.backends.activation.urls')),
    path(r'', include('django.contrib.auth.urls')),
    path(r'', NoteListView.as_view(), name='homepage',),
    path(r'forum/', include('forum.urls')),
    path(r'n/', include('notes.notes_urls')),
    path(r'o/', include('outlines.urls')),
    path(r'nb/', include('notes.notebook_urls')),
    path(r'api/v1/', include(router.urls)),
    path(r'<slug>', PageDetailView.as_view(), name="pages"),
    #path(r'<path>/<slug>/', PageDetailView.as_view(), name="pages"),
    path(r'api-auth/', include('rest_framework.urls', namespace='rest_framework'))
]
#if settings.DEBUG:
    #import debug_toolbar
    #urlpatterns = [
    #    path('__debug__/', include(debug_toolbar.urls)),

        # For django versions before 2.0:
        # url(r'^__debug__/', include(debug_toolbar.urls)),

    #] + urlpatterns