from django.conf.urls.static import static from django.contrib.sitemaps.views import sitemap from django.urls import path, include from django.views.decorators.cache import cache_page from django.views.generic import RedirectView from rest_framework import routers from acronomy import settings from . import views from .sitemaps import AcronymSitemap router = routers.DefaultRouter() router.register(r'acronym', views.AcronymViewSet) router.register(r'tag', views.TagViewSet) sitemaps = { "acronyms": AcronymSitemap } urlpatterns = [ path('account/', include('django.contrib.auth.urls')), path("sitemap.xml", cache_page(60 * 15)(sitemap), {"sitemaps": sitemaps}, name="sitemap"), path('api/', include(router.urls), name="api"), path('', views.IndexView.as_view(), name='index'), path('acronym', RedirectView.as_view(pattern_name="overview")), path('acronym/add', views.AddView.as_view(), name="add"), path('acronym/', views.DetailView.as_view(), name='detail'), path('acronym//edit', views.EditView.as_view(), name='edit'), path('acronym//edit-letters', views.EditLetterView.as_view(), name='edit_letter'), path('acronym//add/wikipedia', views.AddWikipediaView.as_view(), name='add_wikipedia'), path('acronym//add/paper', views.AddPaperView.as_view(), name='add_paper'), path('acronym//add/weblink', views.AddWeblinkView.as_view(), name='add_weblink'), path('acronyms', views.OverView.as_view(), name='overview'), path('tags', views.TagListView.as_view(), name='tags'), path('tag', RedirectView.as_view(pattern_name="tags")), path('tag/', views.TagAcroView.as_view(), name='tag'), path('integrations', views.IntegrationsView.as_view(), name="integrations"), path('datachecks', views.DataCheckView.as_view(), name="datachecks") ] if settings.DEBUG: import debug_toolbar urlpatterns.append(path("css", views.debug_css, name="css")) urlpatterns.append(path("css_sourcemap", views.debug_css_sourcemap, name="css_sourcemap")) urlpatterns = [ path('__debug__/', include(debug_toolbar.urls)), ] + urlpatterns urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)