示例#1
0
            path('sentry-debug', lambda r: 1 / 0)
            if settings.SENTRY_DSN and settings.DEBUG else None,

            # set up set language redirect view
            url('i18n/', include('django.conf.urls.i18n')),
        ]))

# Anything that needs to respect the localised
# url format with /<language_code>/ infixed needs
# to be wrapped by django's i18n_patterns feature:
urlpatterns += i18n_patterns(
    # Buyer's Guide / Privacy Not Included
    url(r'^privacynotincluded/', include('networkapi.buyersguide.urls')),

    # Blog RSS feed
    path('blog/rss/', RSSFeed()),
    path('blog/atom/', AtomFeed()),

    # redirect /opportunity Wagtail pages to /initiatives
    # see https://github.com/mozilla/foundation.mozilla.org/issues/2971 for context
    url(r'^opportunity/(?P<subpath>.*)', redirect_to_initiatives),

    # wagtail-managed data
    url(r'', include(wagtail_urls)),
)

if settings.USE_S3 is not True:
    urlpatterns += static(settings.MEDIA_URL,
                          document_root=settings.MEDIA_ROOT)

# Use a custom 404 handler so that we can serve distinct 404
    # Sentry test url
    path('sentry-debug', lambda r:  1 / 0) if settings.SENTRY_DSN and settings.DEBUG else None,

    # set up set language redirect view
    path('i18n/', include('django.conf.urls.i18n')),

    # Wagtail Footnotes package
    path("footnotes/", include(footnotes_urls)),
]))

# Anything that needs to respect the localised
# url format with /<language_code>/ infixed needs
# to be wrapped by django's i18n_patterns feature:
urlpatterns += i18n_patterns(
    # Blog RSS feed
    path('blog/rss/', RSSFeed(), name='rss-feed'),
    path('blog/atom/', AtomFeed()),

    # Redirects
    *foundation_redirects(),

    # wagtail-managed data
    re_path(r'', include(wagtail_urls)),

    # Buyer's Guide / Privacy Not Included
    re_path(r'^privacynotincluded/', include('networkapi.buyersguide.urls')),
)

if settings.USE_S3 is not True:
    urlpatterns += static(
        settings.MEDIA_URL,