make archivebox server work for urls, hashes, and timestamps

This commit is contained in:
Nick Sweeting 2019-04-30 23:13:21 -04:00
parent 95007d9137
commit d26f87efef
4 changed files with 79 additions and 24 deletions

View file

@ -1,7 +1,10 @@
from django.contrib import admin
from django.urls import path, include
from django.views import static
from django.conf import settings
from django.contrib.staticfiles import views
from django.views.generic.base import RedirectView
from core.views import MainIndex, AddLinks, LinkDetails
@ -9,17 +12,19 @@ admin.site.site_header = 'ArchiveBox Admin'
admin.site.index_title = 'Archive Administration'
urlpatterns = [
path('archive/<timestamp>/', LinkDetails.as_view(), name='LinkDetails'),
path('index.html', RedirectView.as_view(url='/')),
path('index.json', static.serve, {'document_root': settings.OUTPUT_DIR, 'path': 'index.json'}),
path('robots.txt', static.serve, {'document_root': settings.OUTPUT_DIR, 'path': 'robots.txt'}),
path('favicon.ico', static.serve, {'document_root': settings.OUTPUT_DIR, 'path': 'favicon.ico'}),
path('archive/', RedirectView.as_view(url='/')),
path('archive/<path:path>', LinkDetails.as_view(), name='LinkAssets'),
path('add/', AddLinks.as_view(), name='AddLinks'),
path('static/<path>', views.serve),
path('accounts/', include('django.contrib.auth.urls')),
path('admin/', admin.site.urls),
path('add/', AddLinks.as_view(), name='AddLinks'),
path('', MainIndex.as_view(), name='Home'),
]
if settings.SERVE_STATIC:
# serve staticfiles via runserver
from django.contrib.staticfiles import views
urlpatterns += [
path('static/<path>', views.serve),
]