bifurqué depuis cliss21/biohdf
93 lignes
2.8 KiB
Python
93 lignes
2.8 KiB
Python
from django.conf import settings
|
|
from django.contrib import admin
|
|
from django.http import HttpResponse
|
|
from django.urls import include, path
|
|
|
|
from wagtail.admin import urls as wagtailadmin_urls
|
|
from wagtail.contrib.sitemaps.views import sitemap
|
|
from wagtail.core import urls as wagtail_urls
|
|
from wagtail.documents import urls as wagtaildocs_urls
|
|
|
|
from biohdf.base import api, feeds, views
|
|
|
|
urlpatterns = [
|
|
path('django-admin/', admin.site.urls),
|
|
|
|
# Wagtail's applications
|
|
path('admin/', include(wagtailadmin_urls)),
|
|
path('documents/', include(wagtaildocs_urls)),
|
|
path('api/v2/', api.api_router.urls),
|
|
|
|
# Local applications
|
|
|
|
# Annonces
|
|
path('ads/create/', views.AdsCreateView.as_view(), name='ads_add'),
|
|
path(
|
|
'ads/<uuid:uuid>/',
|
|
views.AdsDetailView.as_view(),
|
|
name='ads_detail',
|
|
),
|
|
path(
|
|
'ads/<uuid:uuid>/update/',
|
|
views.AdsUpdateView.as_view(),
|
|
name='ads_update',
|
|
),
|
|
path(
|
|
'ads/<uuid:uuid>/delete/',
|
|
views.AdsDeleteView.as_view(),
|
|
name='ads_delete',
|
|
),
|
|
path(
|
|
'ads/<int:id>/answer/',
|
|
views.AdsAnswerView.as_view(),
|
|
name='ads_answer',
|
|
),
|
|
|
|
# Feeds
|
|
path('feeds/', feeds.AllEntriesFeed(), name='feeds'),
|
|
path('feeds/<int:sitepage_id>/', feeds.IndexFeed(), name='index_feeds'),
|
|
|
|
# Carto
|
|
path('carto-full/', views.CartoView.as_view(), name='carto'),
|
|
|
|
# Search
|
|
path('search/', views.SearchView.as_view(), name='search'),
|
|
|
|
# SEO
|
|
path('sitemap.xml', sitemap),
|
|
path('robots.txt', lambda r:HttpResponse(
|
|
'Sitemap: {}'.format(r.build_absolute_uri('sitemap.xml')),
|
|
content_type="text/plain",
|
|
)),
|
|
|
|
# Politique de confidentialité
|
|
path('politique-de-confidentialite/',
|
|
views.PrivacyPolicyView.as_view(),
|
|
name='privacy-policy'),
|
|
]
|
|
|
|
if settings.DEBUG:
|
|
from django.conf.urls.static import static
|
|
from django.views import defaults as default_views
|
|
|
|
# This allows the error pages to be debugged during development, just visit
|
|
# these url in browser to see how these error pages look like.
|
|
urlpatterns += [
|
|
path('400/', default_views.bad_request,
|
|
kwargs={'exception': Exception('Bad Request!')}),
|
|
path('403/', default_views.permission_denied,
|
|
kwargs={'exception': Exception('Permission Denied')}),
|
|
path('404/', default_views.page_not_found,
|
|
kwargs={'exception': Exception('Page not Found')}),
|
|
path('500/', default_views.server_error),
|
|
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
|
|
|
if 'debug_toolbar' in settings.INSTALLED_APPS:
|
|
import debug_toolbar
|
|
urlpatterns.insert(0, path('__debug__/', include(debug_toolbar.urls)))
|
|
|
|
# Root application
|
|
urlpatterns += [
|
|
path('', include(wagtail_urls)),
|
|
]
|