mirror of
https://github.com/YunoHost-Apps/django-for-runners_ynh.git
synced 2024-09-03 18:26:16 +02:00
Bugfix urls.py
This commit is contained in:
parent
849e158040
commit
819309797b
1 changed files with 13 additions and 20 deletions
|
@ -1,28 +1,21 @@
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.conf.urls import include, static, url
|
|
||||||
from django.conf.urls.i18n import i18n_patterns
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.urls import path
|
from django.urls import path
|
||||||
from django.views.generic import RedirectView
|
from django.views.generic import RedirectView
|
||||||
from for_runners.views.media_files import UserMediaView
|
|
||||||
|
|
||||||
|
|
||||||
|
# settings.PATH_URL is the $YNH_APP_ARG_PATH
|
||||||
|
if settings.PATH_URL:
|
||||||
admin.autodiscover()
|
admin.autodiscover()
|
||||||
|
|
||||||
|
|
||||||
urlpatterns = i18n_patterns(
|
|
||||||
path("{settings.PATH_URL}/admin/", admin.site.urls),
|
|
||||||
|
|
||||||
# FIXME:
|
|
||||||
# until there is not real CMS pages: redirect to the interesting admin page:
|
|
||||||
url(r"^{settings.PATH_URL}/$", RedirectView.as_view(pattern_name='admin:index')),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
# TODO: Change from user name to ID?
|
# TODO:
|
||||||
path('{settings.PATH_URL}/media/<slug:user_name>/<path:path>', UserMediaView.as_view()),
|
# XXX: Hack - the MEDIA_URL contains the "PATH_URL" already:
|
||||||
] + urlpatterns
|
# path(settings.MEDIA_URL.lstrip('/'), include('django_tools.serve_media_app.urls')),
|
||||||
|
|
||||||
if settings.DEBUG:
|
path(f'{settings.PATH_URL}/admin/', admin.site.urls),
|
||||||
import debug_toolbar
|
path('', RedirectView.as_view(pattern_name='admin:index')),
|
||||||
urlpatterns = [url(r'^__debug__/', include(debug_toolbar.urls))] + urlpatterns
|
]
|
||||||
|
else:
|
||||||
|
# Installed to domain root, without a path prefix?
|
||||||
|
from inventory_project.urls import urlpatterns # noqa
|
||||||
|
|
Loading…
Reference in a new issue