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), -]