combo/combo/urls.py

65 lines
2.3 KiB
Python

# combo - content management system
# Copyright (C) 2015 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 import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.views.i18n import javascript_catalog
from .urls_utils import decorated_includes, manager_required
from .public.views import login, logout, error404, mellon_page_hook
from .manager.urls import urlpatterns as combo_manager_urls
from . import plugins
urlpatterns = [
url(r'^manage/', decorated_includes(manager_required,
include(combo_manager_urls))),
url(r'^admin/', admin.site.urls),
url(r'^logout/$', logout, name='auth_logout'),
url(r'^login/$', login, name='auth_login'),
url(r'^404$', error404),
url(r'^jsi18n$', javascript_catalog, name='javascript-catalog'),
]
handler404 = error404
if 'mellon' in settings.INSTALLED_APPS:
urlpatterns.append(url(r'^accounts/mellon/', include('mellon.urls'),
kwargs={
'template_base': 'combo/mellon_base_template.html',
'context_hook': mellon_page_hook,
})
)
# 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
urlpatterns = [
url(r'^__debug__/', include(debug_toolbar.urls)),
] + urlpatterns
urlpatterns = plugins.register_plugins_urls(urlpatterns)
# other URLs are handled as public URLs
urlpatterns.append(url(r'', include('combo.public.urls')))