From 4a190936b7d40c0f2e72d03e619aae0c29e64e36 Mon Sep 17 00:00:00 2001 From: JensDiemer Date: Sun, 17 Jan 2021 11:41:27 +0100 Subject: [PATCH] ynh_urls.py -> urls.py --- conf/urls.py | 18 ++++++++++++++++++ conf/ynh_urls.py | 23 ----------------------- 2 files changed, 18 insertions(+), 23 deletions(-) create mode 100644 conf/urls.py delete mode 100644 conf/ynh_urls.py diff --git a/conf/urls.py b/conf/urls.py new file mode 100644 index 0000000..1feb1cc --- /dev/null +++ b/conf/urls.py @@ -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 diff --git a/conf/ynh_urls.py b/conf/ynh_urls.py deleted file mode 100644 index dc21199..0000000 --- a/conf/ynh_urls.py +++ /dev/null @@ -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'request.META:
{meta}
' -# 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), -]