2023-05-26 19:09:08 +02:00
|
|
|
"""
|
|
|
|
urls.py
|
|
|
|
~~~~~~~
|
|
|
|
|
|
|
|
Look at real examples, here:
|
|
|
|
|
2023-05-26 19:29:29 +02:00
|
|
|
* https://github.com/eldertek/django-fritzconnection_ynh/blob/master/conf/urls.py
|
|
|
|
* https://github.com/eldertek/django-for-runners_ynh/blob/testing/conf/urls.py
|
|
|
|
* https://github.com/eldertek/pyinventory_ynh/blob/testing/conf/urls.py
|
2023-05-26 19:09:08 +02:00
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
from django.conf import settings
|
|
|
|
from django.urls import include, path
|
|
|
|
from django.views.generic import RedirectView
|
|
|
|
|
|
|
|
|
|
|
|
if settings.PATH_URL:
|
|
|
|
# settings.PATH_URL is the $YNH_APP_ARG_PATH
|
|
|
|
# Prefix all urls with "PATH_URL":
|
|
|
|
urlpatterns = [
|
|
|
|
path('', RedirectView.as_view(url=f'{settings.PATH_URL}/')),
|
|
|
|
path(f'{settings.PATH_URL}/', include('django_example.urls')),
|
|
|
|
]
|
|
|
|
else:
|
|
|
|
# Installed to domain root, without a path prefix
|
|
|
|
# Just use the default project urls.py
|
|
|
|
from django_example.urls import urlpatterns # noqa
|