diff options
author | luxagraf <sng@luxagraf.net> | 2018-01-21 11:08:43 -0700 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2018-01-21 11:08:43 -0700 |
commit | 342e3f0450f2a13fe3f2c99d0cc28d053592293e (patch) | |
tree | fb58e7b2b3a1659315162bf7028fd94afd888b6b /config | |
parent | 7dbb0c01c941f933914ff0f0d5567a4a7ac7e99c (diff) |
updated code to work with django 2.0
Diffstat (limited to 'config')
-rw-r--r-- | config/base_urls.py | 90 |
1 files changed, 27 insertions, 63 deletions
diff --git a/config/base_urls.py b/config/base_urls.py index c865c20..1a0ea83 100644 --- a/config/base_urls.py +++ b/config/base_urls.py @@ -1,6 +1,6 @@ -from django.conf.urls import url, include +from django.urls import path, re_path, include from django.contrib import admin -from django.views import static +from django.conf.urls.static import static from django.conf import settings from django.contrib.sitemaps.views import sitemap from django.views.generic import TemplateView @@ -17,6 +17,7 @@ from figments.models import FigmentSitemap from projects.models.base import ProjectSitemap import builder.views import utils.views +from utils.views import TagAutocomplete from locations.views import MapDataList @@ -31,70 +32,33 @@ sitemaps = { } urlpatterns = [ - url(r'^projects/data/natparks/(?P<path>.*)$', static.serve, {'document_root': settings.PROJ_ROOT + 'site/projects/data/natparks/'}), - url( - r'^media/js/mainmap.js$', - MapDataList.as_view(), - name="mapdatalist" - ), - url (r'media/js/leaflet-providers.js', - TemplateView.as_view(template_name='js/leaflet-providers.js') - ), - url(r'^media/admin/(?P<path>.*)$', static.serve, {'document_root': settings.MEDIA_ROOT + '/admin'}), - url(r'^media/(?P<path>.*)$', static.serve, {'document_root': settings.MEDIA_ROOT}), -] - - -from utils.views import TagAutocomplete - -urlpatterns += [ - url( - r'^tag-autocomplete/$', - TagAutocomplete.as_view(), - name='tag-autocomplete', - ), - url(r'^admin/build/.*', builder.views.do_build), - url(r'^admin/', include(admin.site.urls),), - url(r'^luximages/insert/', utils.views.insert_image), - url(r'^sitemap.xml$', sitemap, {'sitemaps': sitemaps}), - url(r'^links/', include('links.urls')), - url(r'^jrnl/', include('jrnl.urls')), - url(r'^projects/', include('projects.urls')), - url(r'^locations/', include('locations.urls')), - url(r'^expenses/', include('expenses.urls', namespace='expenses')), - url(r'^photos/', include('photos.urls')), - url(r'^books/', include('books.urls')), - url(r'^field-notes/', include('notes.urls')), - url( - r'^birds/', - include('birds.urls', namespace='birds') - ), - url(r'^src/', include('src.urls', namespace='src')), - url(r'^figments/', include('figments.urls', namespace='figments')), - url(r'^resume/', include('resume.urls', namespace='resume')), - url(r'^map/', include('locations.urls', namespace='map')), - url( - r'^$', - HomepageList.as_view(), - name="homepage" - ), - # facebook ia feed - url(r'^comments/', include('django_comments.urls')), - # pages - url(r'^(?P<slug>[-\w]+)/?$', PageDetailView.as_view()), - url(r'^(?P<path>[-\w]+)/(?P<slug>[-\w]+)?$', PageDetailView.as_view()), -] + path(r'tag-autocomplete/', TagAutocomplete.as_view(), name='tag-autocomplete'), + re_path(r'^admin/build/.*', builder.views.do_build), + path(r'admin/', admin.site.urls), + path(r'luximages/insert/', utils.views.insert_image), + path(r'sitemap.xml', sitemap, {'sitemaps': sitemaps}), + path(r'links/', include('links.urls')), + path(r'jrnl/', include('jrnl.urls')), + path(r'projects/', include('projects.urls')), + path(r'locations/', include('locations.urls')), + path(r'expenses/', include('expenses.urls', namespace='expenses')), + path(r'photos/', include('photos.urls')), + path(r'books/', include('books.urls')), + path(r'field-notes/', include('notes.urls')), + path(r'birds/', include('birds.urls', namespace='birds')), + path(r'src/', include('src.urls', namespace='src')), + path(r'figments/', include('figments.urls', namespace='figments')), + path(r'resume/', include('resume.urls', namespace='resume')), + path(r'map', include('locations.urls', namespace='map')), + path(r'', HomepageList.as_view(), name="homepage"), + path(r'comments/', include('django_comments.urls')), + path(r'<slug>', PageDetailView.as_view()), + path(r'<path>/<slug>/', PageDetailView.as_view()), +] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) -urlpatterns += [ - url( - r'^static/(?P<path>.*)$', - static.serve, - {'document_root': settings.STATIC_ROOT, } - ), -] if settings.DEBUG: import debug_toolbar urlpatterns = [ - url(r'^__debug__/', include(debug_toolbar.urls)), + path(r'__debug__/', include(debug_toolbar.urls)), ] + urlpatterns |