lingo/lingo/urls.py

54 lines
1.9 KiB
Python

# lingo - payment and billing system
# Copyright (C) 2022 Entr'ouvert
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from .manager.urls import urlpatterns as lingo_manager_urls
from .urls_utils import decorated_includes, manager_required
from .views import homepage, login, logout
urlpatterns = [
url(r'^$', homepage, name='homepage'),
url(r'^manage/', decorated_includes(manager_required, include(lingo_manager_urls))),
url(r'^login/$', login, name='auth_login'),
url(r'^logout/$', logout, name='auth_logout'),
]
if 'mellon' in settings.INSTALLED_APPS:
urlpatterns.append(
url(
r'^accounts/mellon/',
include('mellon.urls'),
kwargs={
'template_base': 'lingo/base.html',
},
)
)
# static and media files
urlpatterns += staticfiles_urlpatterns()
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
if settings.DEBUG and 'debug_toolbar' in settings.INSTALLED_APPS:
import debug_toolbar # pylint: disable=import-error
urlpatterns = [
url(r'^__debug__/', include(debug_toolbar.urls)),
] + urlpatterns