2022-08-14 14:44:17 +02:00
|
|
|
"""
|
|
|
|
urls.py
|
|
|
|
~~~~~~~
|
|
|
|
|
|
|
|
Look at real examples, here:
|
|
|
|
|
|
|
|
* https://github.com/YunoHost-Apps/django-fritzconnection_ynh/blob/master/conf/urls.py
|
|
|
|
* https://github.com/YunoHost-Apps/django-for-runners_ynh/blob/testing/conf/urls.py
|
|
|
|
* https://github.com/YunoHost-Apps/pyinventory_ynh/blob/testing/conf/urls.py
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
2020-12-23 19:53:13 +01:00
|
|
|
from django.conf import settings
|
2022-10-06 17:32:07 +02:00
|
|
|
from django.urls import include, path
|
|
|
|
from django.views.generic import RedirectView
|
2020-12-23 19:53:13 +01:00
|
|
|
|
|
|
|
|
2022-08-14 14:44:17 +02:00
|
|
|
if settings.PATH_URL:
|
|
|
|
# settings.PATH_URL is the $YNH_APP_ARG_PATH
|
|
|
|
# Prefix all urls with "PATH_URL":
|
|
|
|
urlpatterns = [
|
2022-10-06 17:32:07 +02:00
|
|
|
path('', RedirectView.as_view(url=f'{settings.PATH_URL}/')),
|
|
|
|
path(f'{settings.PATH_URL}/', include('django_example.urls')),
|
2022-08-14 14:44:17 +02:00
|
|
|
]
|
|
|
|
else:
|
|
|
|
# Installed to domain root, without a path prefix
|
2022-10-06 17:32:07 +02:00
|
|
|
# Just use the default project urls.py
|
|
|
|
from django_example.urls import urlpatterns # noqa
|