from django.conf.urls import url
from django_yaml_redirects import load_redirects
from django_template_finder_view import TemplateFinder
from ubuntudesign.gsa.views import SearchView

# Local
from webapp.views import custom_404, custom_500, MarkdownView

# Match any redirects first
urlpatterns = load_redirects()

default_markdown_template = "includes/base_markdown.html"

# Try to find templates
urlpatterns += [
    url(r"^search/?$", SearchView.as_view(template_name="pages/search.html")),
    url(
        r"^(?P<path>core(/.*)?)$",
        MarkdownView.as_view(),
        {"template_name": default_markdown_template},
    ),
    url(
        r"^(?P<path>community-resources(/.*)?)$",
        MarkdownView.as_view(),
        {"template_name": default_markdown_template},
    ),
    url(
        r"^(?P<path>snapcraft(/.*)?)$",
        MarkdownView.as_view(),
        {"template_name": default_markdown_template},
    ),
示例#2
0
# Third party modules
from django.conf.urls import url
from django_yaml_redirects import load_redirects
from canonicalwebteam import yaml_deleted_paths
from ubuntudesign.gsa.views import SearchView

# Local code
from .views import UbuntuTemplateFinder, DownloadView

urlpatterns = load_redirects()
urlpatterns += yaml_deleted_paths.create_views()
urlpatterns += [
    url(r'^(?P<template>download/(desktop|server|cloud)/thank-you)$',
        DownloadView.as_view()),
    url(r'^(?P<template>download/desktop/contribute)$',
        DownloadView.as_view()),
    url(r'^search$', SearchView.as_view(template_name='search.html')),
    url(r'^(?P<template>.*)[^\/]$', UbuntuTemplateFinder.as_view()),
    url(r'$^', UbuntuTemplateFinder.as_view()),
]