ynh_urls.py -> urls.py

This commit is contained in:
JensDiemer 2021-01-17 11:41:27 +01:00
parent 44a17f510f
commit 4a190936b7
2 changed files with 18 additions and 23 deletions

18
conf/urls.py Normal file
View file

@ -0,0 +1,18 @@
from django.conf import settings
from django.conf.urls import static
from django.contrib import admin
from django.urls import path
if settings.PATH_URL:
# settings.PATH_URL is the $YNH_APP_ARG_PATH
# Prefix all urls with "PATH_URL":
urlpatterns = [
path(f'{settings.PATH_URL}/', admin.site.urls),
]
if settings.SERVE_FILES:
urlpatterns += static.static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
else:
# Installed to domain root, without a path prefix
# Just use the default project urls.py
from for_runners_project.urls import urlpatterns # noqa

View file

@ -1,23 +0,0 @@
from django.conf import settings
from django.contrib import admin
from django.urls import path
# def debug_view(request):
# """ debug request.META """
# if not request.user.is_authenticated:
# from django.shortcuts import redirect
# return redirect('admin:index')
#
# import pprint
# meta = pprint.pformat(request.META)
# html = f'<html><body>request.META: <pre>{meta}</pre></body></html>'
# from django.http import HttpResponse
# return HttpResponse(html)
admin.autodiscover()
urlpatterns = [
# path(f'{settings.PATH_URL}/debug/', debug_view),
path(f'{settings.PATH_URL}/', admin.site.urls),
]