2020-12-28 11:26:12 +00:00
|
|
|
import os
|
|
|
|
|
2020-09-22 15:00:28 +00:00
|
|
|
from django.conf import settings
|
2020-12-28 11:56:53 +00:00
|
|
|
from django.conf.urls import url
|
2020-07-05 11:57:38 +00:00
|
|
|
from django.contrib import admin
|
2020-12-28 11:26:12 +00:00
|
|
|
from django.urls import path, re_path
|
2020-07-05 12:04:24 +00:00
|
|
|
from django.views.generic import TemplateView
|
2020-12-28 11:26:12 +00:00
|
|
|
from django.views.static import serve
|
|
|
|
from django.contrib.staticfiles import finders
|
2020-07-05 11:57:38 +00:00
|
|
|
|
|
|
|
urlpatterns = [
|
2020-11-14 15:04:41 +00:00
|
|
|
url(r"^admin/", admin.site.urls),
|
|
|
|
path("", TemplateView.as_view(template_name="success.html")),
|
2020-07-05 11:57:38 +00:00
|
|
|
]
|
2020-09-22 15:00:28 +00:00
|
|
|
|
|
|
|
if settings.DEBUG:
|
2020-12-28 11:26:12 +00:00
|
|
|
|
|
|
|
def serve_static(request, path):
|
|
|
|
filename = finders.find(path)
|
|
|
|
dirname = os.path.dirname(filename)
|
|
|
|
basename = os.path.basename(filename)
|
|
|
|
|
|
|
|
return serve(request, basename, dirname)
|
|
|
|
|
|
|
|
urlpatterns += [re_path(r"^static/(?P<path>.*)$", serve_static)]
|