Exemple #1
0
    """
    A convenience function which also makes it easy to override the
    settings within tests.
    """
    return serve(request, path, document_root=settings.MEDIA_ROOT)


admin.autodiscover()

handler403 = core_views.handler403
handler404 = core_views.handler404
handler500 = core_views.handler500

urlpatterns = [url('', include('kuma.health.urls'))]
urlpatterns += [url('', include('kuma.landing.urls'))]
urlpatterns += i18n_patterns(url('', include(landing_lang_urlpatterns)))
urlpatterns += i18n_patterns(
    url(r'^events',
        shared_cache_control(
            RedirectView.as_view(url='https://mozilla.org/contribute/events',
                                 permanent=False)),
        name='events'), )

if settings.MAINTENANCE_MODE:
    urlpatterns.append(
        url(
            r'^admin/.*',
            never_cache(
                RedirectView.as_view(pattern_name='maintenance_mode',
                                     permanent=False))))
else:
Exemple #2
0
from django.conf import settings
from django.conf.urls import include, url

from kuma.core import views as core_views
from kuma.core.urlresolvers import i18n_patterns
from kuma.landing.urls_beta import lang_urlpatterns as landing_lang_urlpatterns

handler403 = core_views.handler403
handler404 = core_views.handler404
handler500 = core_views.handler500


urlpatterns = [
    url('^api/', include('kuma.api.urls')),
    # The non-locale-based landing URL's
    url('', include('kuma.landing.urls_beta')),
]
# The locale-based landing URL's
urlpatterns += i18n_patterns(url('', include(landing_lang_urlpatterns)))
# The beta docs URL's (all of which are locale-based)
urlpatterns += i18n_patterns(url(r'^docs/', include('kuma.wiki.urls_beta')))

if getattr(settings, 'DEBUG_TOOLBAR_INSTALLED', False):
    import debug_toolbar
    urlpatterns.append(url(r'^__debug__/', include(debug_toolbar.urls)))
Exemple #3
0
DAY = 60 * 60 * 24
WEEK = DAY * 7
MONTH = DAY * 30

admin.autodiscover()

handler403 = core_views.handler403
handler404 = core_views.handler404
handler500 = core_views.handler500

urlpatterns = [re_path("", include("kuma.health.urls"))]
# The non-locale-based landing URL's
urlpatterns += [re_path("", include("kuma.landing.urls"))]
# The locale-based landing URL's
urlpatterns += i18n_patterns(re_path("", include(landing_lang_urlpatterns)))
urlpatterns += i18n_patterns(
    re_path(
        r"^events",
        # Here the "shared_cache_control" decorator is an optimization. It
        # informs the CDN to cache the redirect for a month, so once this URL
        # has been requested by a client, all other client requests will be
        # redirected by the CDN instead of this Django service.
        shared_cache_control(s_maxage=MONTH)(
            RedirectView.as_view(
                url="https://mozilla.org/contribute/events", permanent=False
            )
        ),
        name="events",
    ),
)
Exemple #4
0
from django.conf import settings
from django.urls import include, re_path

from kuma.core import views as core_views
from kuma.core.urlresolvers import i18n_patterns
from kuma.landing.views import robots_txt
from kuma.wiki.urls_untrusted import lang_urlpatterns as wiki_lang_urlpatterns

handler403 = core_views.handler403
handler404 = core_views.handler404
handler500 = core_views.handler500

urlpatterns = [
    re_path("", include("kuma.attachments.urls")),
    re_path(r"^robots.txt", robots_txt, name="robots_txt"),
]

if getattr(settings, "DEBUG_TOOLBAR_INSTALLED", False):
    import debug_toolbar

    urlpatterns.append(re_path(r"^__debug__/", include(debug_toolbar.urls)), )

urlpatterns += i18n_patterns(re_path(r"^docs/",
                                     include(wiki_lang_urlpatterns)))
Exemple #5
0
DAY = 60 * 60 * 24
WEEK = DAY * 7
MONTH = DAY * 30

admin.autodiscover()

handler403 = core_views.handler403
handler404 = core_views.handler404
handler500 = core_views.handler500

urlpatterns = [url('', include('kuma.health.urls'))]
# The non-locale-based landing URL's
urlpatterns += [url('', include('kuma.landing.urls'))]
# The locale-based landing URL's
urlpatterns += i18n_patterns(url('', include(landing_lang_urlpatterns)))
urlpatterns += i18n_patterns(
    url(
        r'^events',
        # Here the "shared_cache_control" decorator is an optimization. It
        # informs the CDN to cache the redirect for a month, so once this URL
        # has been requested by a client, all other client requests will be
        # redirected by the CDN instead of this Django service.
        shared_cache_control(s_maxage=MONTH)
        (RedirectView.as_view(url='https://mozilla.org/contribute/events',
                              permanent=False)),
        name='events'), )

if settings.MAINTENANCE_MODE:
    urlpatterns.append(
        url(
Exemple #6
0
DAY = 60 * 60 * 24
MONTH = DAY * 30
YEAR = DAY * 365

redirect_to_attachments_domain = shared_cache_control(
    RedirectView.as_view(url=settings.ATTACHMENT_SITE_URL + '/%(path)s'),
    s_maxage=YEAR)

urlpatterns = [
    url('', include('kuma.health.urls')),
    url('^api/', include('kuma.api.urls')),
    # The non-locale-based landing URL's
    url('', include('kuma.landing.urls_beta')),
]
# The locale-based landing URL's
urlpatterns += i18n_patterns(url('', include(landing_lang_urlpatterns)))
# The beta docs URL's (all of which are locale-based)
urlpatterns += i18n_patterns(url(r'^docs/', include('kuma.wiki.urls_beta')))
# The beta search URL
urlpatterns += i18n_patterns(url(r'^search$',
                                 include('kuma.search.urls_beta')))

# The version, sitemap, humans, and file-attachment URL's (all non-locale-based)
urlpatterns += [
    url('', include('kuma.version.urls')),
    url(r'^sitemap.xml$',
        beta_shared_cache_control(serve_from_media_root),
        {'path': 'sitemap.xml'},
        name='sitemap'),
    url(r'^(?P<path>sitemaps/.+)$',
        beta_shared_cache_control(serve_from_media_root),
Exemple #7
0
from django.conf.urls import url
from django.core.exceptions import SuspiciousOperation

from kuma.core.urlresolvers import i18n_patterns


def suspicious(request):
    raise SuspiciousOperation('Raising exception to test logging.')


urlpatterns = i18n_patterns(
    url(r'^suspicious/$',
        suspicious,
        name='suspicious')
)
Exemple #8
0
from django.conf.urls import url
from django.core.exceptions import SuspiciousOperation

from kuma.core.urlresolvers import i18n_patterns


def suspicious(request):
    raise SuspiciousOperation("Raising exception to test logging.")


urlpatterns = i18n_patterns(
    url(r"^suspicious/$", suspicious, name="suspicious"))
Exemple #9
0
from django.conf import settings
from django.conf.urls import include, url

from kuma.core import views as core_views
from kuma.core.urlresolvers import i18n_patterns
from kuma.landing.views import robots_txt
from kuma.wiki.urls_untrusted import lang_urlpatterns as wiki_lang_urlpatterns

handler403 = core_views.handler403
handler404 = core_views.handler404
handler500 = core_views.handler500

urlpatterns = [
    url('', include('kuma.attachments.urls')),
    url(r'^robots.txt', robots_txt, name='robots_txt'),
]

if getattr(settings, 'DEBUG_TOOLBAR_INSTALLED', False):
    import debug_toolbar
    urlpatterns.append(url(r'^__debug__/', include(debug_toolbar.urls)), )

urlpatterns += i18n_patterns(url(r'^docs/', include(wiki_lang_urlpatterns)))
Exemple #10
0
MONTH = DAY * 30
YEAR = DAY * 365

redirect_to_attachments_domain = shared_cache_control(
    RedirectView.as_view(url=settings.ATTACHMENT_SITE_URL + '/%(path)s'),
    s_maxage=YEAR
)

urlpatterns = [
    url('', include('kuma.health.urls')),
    url('^api/', include('kuma.api.urls')),
    # The non-locale-based landing URL's
    url('', include('kuma.landing.urls_beta')),
]
# The locale-based landing URL's
urlpatterns += i18n_patterns(url('', include(landing_lang_urlpatterns)))
# The beta docs URL's (all of which are locale-based)
urlpatterns += i18n_patterns(url(r'^docs/', include('kuma.wiki.urls_beta')))
# The version, sitemap, humans, and file-attachment URL's (all non-locale-based)
urlpatterns += [
    url('', include('kuma.version.urls')),
    url(r'^sitemap.xml$', beta_shared_cache_control(serve_from_media_root),
        {'path': 'sitemap.xml'}, name='sitemap'),
    url(r'^(?P<path>sitemaps/.+)$',
        beta_shared_cache_control(serve_from_media_root), name='sitemaps'),
    url(r'^humans.txt$', beta_shared_cache_control(serve),
        {'document_root': settings.HUMANSTXT_ROOT, 'path': 'humans.txt'}),
    # Redirect file attachment URL's to the attachments domain, and
    # let that domain determine whether or not the file exists.
    url(r'^(?P<path>files/.+)$', redirect_to_attachments_domain,
        name='attachments.raw_file'),
Exemple #11
0
from django.conf import settings
from django.conf.urls import include, url

from kuma.core import views as core_views
from kuma.core.urlresolvers import i18n_patterns
from kuma.landing.views import robots_txt
from kuma.wiki.urls_untrusted import lang_urlpatterns as wiki_lang_urlpatterns

handler403 = core_views.handler403
handler404 = core_views.handler404
handler500 = core_views.handler500

urlpatterns = [
    url('', include('kuma.attachments.urls')),
    url(r'^robots.txt', robots_txt, name='robots_txt'),
]

if getattr(settings, 'DEBUG_TOOLBAR_INSTALLED', False):
    import debug_toolbar
    urlpatterns.append(
        url(r'^__debug__/', include(debug_toolbar.urls)),
    )

urlpatterns += i18n_patterns(url(r'^docs/', include(wiki_lang_urlpatterns)))
Exemple #12
0
from __future__ import unicode_literals

from django.conf.urls import url
from django.core.exceptions import SuspiciousOperation

from kuma.core.urlresolvers import i18n_patterns


def suspicious(request):
    raise SuspiciousOperation('Raising exception to test logging.')


urlpatterns = i18n_patterns(
    url(r'^suspicious/$',
        suspicious,
        name='suspicious')
)
Exemple #13
0
    """
    A convenience function which also makes it easy to override the
    settings within tests.
    """
    return serve(request, path, document_root=settings.MEDIA_ROOT)


admin.autodiscover()

handler403 = core_views.handler403
handler404 = core_views.handler404
handler500 = core_views.handler500

urlpatterns = [url('', include('kuma.health.urls'))]
urlpatterns += [url('', include('kuma.landing.urls'))]
urlpatterns += i18n_patterns(url('', include(landing_lang_urlpatterns)))
urlpatterns += i18n_patterns(
    url(
        r'^events',
        shared_cache_control(RedirectView.as_view(
            url='https://mozilla.org/contribute/events',
            permanent=False
        )),
        name='events'
    ),
)

if settings.MAINTENANCE_MODE:
    urlpatterns.append(
        url(
            r'^admin/.*',