You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
708 B
Python
26 lines
708 B
Python
4 years ago
|
import os
|
||
|
|
||
4 years ago
|
from django.conf import settings
|
||
4 years ago
|
from django.conf.urls import url
|
||
4 years ago
|
from django.contrib import admin
|
||
4 years ago
|
from django.urls import path, re_path
|
||
4 years ago
|
from django.views.generic import TemplateView
|
||
4 years ago
|
from django.views.static import serve
|
||
|
from django.contrib.staticfiles import finders
|
||
4 years ago
|
|
||
|
urlpatterns = [
|
||
4 years ago
|
url(r"^admin/", admin.site.urls),
|
||
|
path("", TemplateView.as_view(template_name="success.html")),
|
||
4 years ago
|
]
|
||
4 years ago
|
|
||
|
if settings.DEBUG:
|
||
4 years ago
|
|
||
|
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)]
|