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 notes.views import NoteViewSet, FolderViewSet, NoteListView from accounts.forms import UserForm router = routers.DefaultRouter() router.register(r'/notes/folder/', FolderViewSet, basename="folder-api") router.register(r'/notes/', NoteViewSet, basename="notes-api") urlpatterns = static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) urlpatterns += [ path('admin/', 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'', include('notes.urls')), path(r'', PageDetailView.as_view(), name="pages"), path(r'//', PageDetailView.as_view(), name="pages"), path(r'api/', include(router.urls)), path(r'api-auth/', include('rest_framework.urls', namespace='rest_framework')) ]