Ejemplo n.º 1
0
    from django.contrib.staticfiles.urls import staticfiles_urlpatterns
    from django.views.generic import TemplateView
    from django.views.generic.base import RedirectView

    # Serve static and media files from development server
    urlpatterns += staticfiles_urlpatterns()
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
    urlpatterns += [
        url(
            r'^favicon\.ico$', RedirectView.as_view(
                url=settings.STATIC_URL + 'img/bread-favicon.ico'
                )
            )
    ]

    # Add views for testing 404 and 500 templates
    urlpatterns += [
        url(r'^test404/$', TemplateView.as_view(template_name='404.html')),
        url(r'^test500/$', TemplateView.as_view(template_name='500.html')),
    ]

urlpatterns += [
    url(r'', include(wagtail_urls)),
]

urlpatterns += [
    url(r'^api/graphql', csrf_exempt(GraphQLView.as_view())),
    url(r'^api/graphiql', csrf_exempt(GraphQLView.as_view(graphiql=True, pretty=True))),
    url(r'^images/([^/]*)/(\d*)/([^/]*)/[^/]*$', ServeView.as_view(), name='wagtailimages_serve'),
]
Ejemplo n.º 2
0
from django.conf.urls import url

from wagtail.images.views.serve import SendFileView, ServeView
from wagtail.tests import dummy_sendfile_backend

urlpatterns = [
    url(r'^actions/serve/(.*)/(\d*)/(.*)/[^/]*',
        ServeView.as_view(action='serve'),
        name='wagtailimages_serve_action_serve'),
    url(r'^actions/redirect/(.*)/(\d*)/(.*)/[^/]*',
        ServeView.as_view(action='redirect'),
        name='wagtailimages_serve_action_redirect'),
    url(r'^custom_key/(.*)/(\d*)/(.*)/[^/]*',
        ServeView.as_view(key='custom'),
        name='wagtailimages_serve_custom_key'),
    url(r'^custom_view/([^/]*)/(\d*)/([^/]*)/[^/]*$',
        ServeView.as_view(),
        name='wagtailimages_serve_custom_view'),
    url(r'^sendfile/(.*)/(\d*)/(.*)/[^/]*',
        SendFileView.as_view(),
        name='wagtailimages_sendfile'),
    url(r'^sendfile-dummy/(.*)/(\d*)/(.*)/[^/]*',
        SendFileView.as_view(backend=dummy_sendfile_backend.sendfile),
        name='wagtailimages_sendfile_dummy'),
]
Ejemplo n.º 3
0
 def test_init_with_unknown_action_raises_error(self):
     with self.assertRaises(ImproperlyConfigured):
         ServeView.as_view(action="unknown")
Ejemplo n.º 4
0
from wagtail.admin import urls as wagtailadmin_urls
from wagtail.core import urls as wagtail_urls
from wagtail.documents import urls as wagtaildocs_urls
from wagtail.contrib.sitemaps.views import sitemap
from wagtail.images.views.serve import ServeView

from core.views import search


# Non-translatable URLs
urlpatterns = [
    url(r"^admin/", include(wagtailadmin_urls)),
    url(r"^documents/", include(wagtaildocs_urls)),
    url(
        r"^images/([^/]*)/(\d*)/([^/]*)/[^/]*$",
        ServeView.as_view(action="redirect"),
        name="wagtailimages_serve",
    ),
    url(r"^sitemap\.xml$", sitemap, name="sitemap"),
    url(
        r"^robots\.txt$",
        TemplateView.as_view(template_name="robots.txt", content_type="text/plain"),
    ),
]

# Translatable URLs
urlpatterns += i18n_patterns(
    url(r"^404/$", page_not_found, kwargs={"exception": Exception("Page not Found")}),
    url(r"^500/$", server_error),
    url(r"^search/", search, name="search",),
    url(r"", include(wagtail_urls)),
Ejemplo n.º 5
0
from falmer.schema import urls as schema_urls
from falmer.newsletters import urls as newsletters_urls
from falmer.frontend import urls as frontend_urls
from falmer.links import urls as links_urls


def redirect_to_my_auth(request):
    return redirect_to_login(reverse('wagtailadmin_home'),
                             login_url='frontend')


urlpatterns = [
    url(r'^cms/login', redirect_to_my_auth, name='wagtailadmin_login'),
    url(settings.ADMIN_URL, admin.site.urls),
    url(r'^images/([^/]*)/(\d*)/([^/]*)/[^/]*$',
        ServeView.as_view(action=settings.IMAGE_SERVE_METHOD),
        name='wagtailimages_serve'),
    path('content-api/v2/', api_router.urls),
    path('admin/', admin.site.urls),
    re_path(r'^cms/pages/(\d+)/view_draft/$', view_draft, name='view_draft'),
    re_path(r'^cms/pages/(\d+)/edit/preview/$',
            PreviewOnEditRemix.as_view(),
            name='preview_on_edit'),
    re_path(r'^cms/', include(wagtailadmin_urls)),
    path('documents/', include(wagtaildocs_urls)),
    path('graphql/', include(schema_urls)),
    path('auth/', include(auth_urls)),
    path('slack/', include(slack_urls)),
    path('images/', include(matte_urls)),
    path('search/', include(search_urls)),
    path('newsletters/', include(newsletters_urls)),
Ejemplo n.º 6
0
 def test_init_with_unknown_action_raises_error(self):
     with self.assertRaises(ImproperlyConfigured):
         ServeView.as_view(action='unknown')
Ejemplo n.º 7
0
    url(r'^search/$', search_view, name='search'),

    url(r'^feed/$', GenericFeed()),
    url(r'^feed/program/(?P<program>[a-zA-z\-]*)/$', ProgramFeed()),
    url(r'^feed/subprogram/(?P<subprogram>[a-zA-z\-]*)/$', SubprogramFeed()),
    url(r'^feed/author/(?P<author>[a-zA-z\-]*)/$', AuthorFeed()),
    url(r'^feed/event/(?P<tense>future|past)/$', EventFeed()),
    url(r'^feed/event/(?P<program>[a-zA-z\-]*)/$', EventProgramFeed()),
    url(r'^feed/event/(?P<program>[a-zA-z\-]*)/(?P<tense>future|past)/$', EventProgramFeed()),
    url(r'^feed/(?P<content_type>[a-zA-z]*)/$', ContentFeed()),
    url(r'^feed/(?P<content_type>[a-zA-z]*)/(?P<program>[a-zA-z\-]*)/$', ContentFeed()),

    url(r'^api/', include(api_urls)),

    url(r'^images/([^/]*)/(\d*)/([^/]*)/[^/]*$', ServeView.as_view(action='redirect'), name='wagtailimages_serve'),

    url(r'^international-security/future-property-rights/[^.]*$', redirects.future_property_rights),
    url(r'^education-policy/dual-language-learners/[^.]*$', redirects.dual_language_learners),
    url(r'^bretton-woods-ii/[^.]*$', redirects.digi),

    url(r'^(?P<program>[a-zA-z\-]*)/(?P<subprogram>[a-zA-Z0-9_\.\-]*)/(our-people|events|projects|publications|topics|about|subscribe)/$', program_views.redirect_to_subprogram),
    url(r'^(?P<program>[a-zA-z\-]*)/(our-people|events|projects|about|publications|topics|subscribe)/$', program_views.redirect_to_program),
    # url(r'^(?P<program>[a-zA-z\-]*)/(?P<subprogram>[a-zA-Z0-9_\.\-]*)/$', program_views.redirect_project_page),

    url(r'', include(wagtail_urls)),

]

if settings.DEBUG:
Ejemplo n.º 8
0
from django.conf.urls import include, url
from django.views.decorators.cache import never_cache

from wagtail.utils.urlpatterns import decorate_urlpatterns
from wagtail.images.views.serve import ServeView

from .api.urls import api_router
from . import views


urlpatterns = [
    url(
        r'^images/([^/]*)/(\d*)/([^/]*)/[^/]*$',
        ServeView.as_view(),
        name='wagtailimages_serve'
    ),
    url(r'^search/$', views.search, name='search'),
    url(
        r'^locale/(?P<locale>[\w\-\_]+)/$',
        views.locale_set,
        name='locale_set'
    ),
    url(
        r'^health/$',
        views.health,
        name='health'
    ),
    url(
        r'^home-index/$',
        views.home_index,
        name='home_index'
Ejemplo n.º 9
0
from api import urls as api_urls
from global_settings.views import throw_error
from wagtail.contrib.sitemaps.views import sitemap

admin.site.site_header = 'OpenStax'

urlpatterns = [
    url(r'^django-admin/login', RedirectView.as_view(url='/admin/login')),
    url(r'^django-admin/', admin.site.urls),
    url(r'^admin/', include(wagtailadmin_urls)),
    url(r'^django-admin/error/', throw_error, name='throw_error'),
    url(r'^oxauth', include('oxauth.urls')),  # new auth package
    url(r'^documents/', include(wagtaildocs_urls)),
    url(r'^images/([^/]*)/(\d*)/([^/]*)/[^/]*$',
        ServeView.as_view(action='redirect'),
        name='wagtailimages_serve'),
    url(r'^accounts',
        include(accounts_urls)),  # non-CloudFront Accounts redirects
    url(r'^apps/cms/api/mail', include('mail.urls')),
    url(r'^apps/cms/api/', include(api_urls)),
    url(r'^apps/cms/api/search/$', search, name='search'),
    url(r'^apps/cms/api/v2/', api_router.urls),
    url(r'^apps/cms/api/salesforce/', include('salesforce.urls')),
    url(r'^apps/cms/api/snippets/', include('snippets.urls')),
    url(r'^apps/cms/api/books', include('books.urls')),
    url(r'^apps/cms/api', include('news.urls')),
    url(r'^blog-feed/rss/$', RssBlogFeed()),
    url(r'^blog-feed/atom/$', AtomBlogFeed()),
    url(r'^errata/', include('errata.urls')),
    url(r'^apps/cms/api/errata/', include('errata.urls')),
Ejemplo n.º 10
0
    urlpatterns += [
        # Add views for testing 404 and 500 templates
        path('test404/', TemplateView.as_view(template_name='404.html')),
        path('test500/', TemplateView.as_view(template_name='500.html')),
    ]

if settings.DEBUG or settings.ENABLE_STYLEGUIDE:
    urlpatterns += [
        # Add styleguide
        path('styleguide/',
             TemplateView.as_view(template_name='styleguide.html')),
    ]

urlpatterns += [
    url(r'^images/([^/]*)/(\d*)/([^/]*)/[^/]*$',
        ServeView.as_view(),
        name='wagtailimages_serve'),
]

urlpatterns += [
    path('', include(wagtail_urls)),
]

if settings.DEBUG:
    import debug_toolbar
    urlpatterns = [
        path('__debug__/', include(debug_toolbar.urls)),
    ] + urlpatterns

base_urlpatterns = [*urlpatterns]
Ejemplo n.º 11
0
from django.conf.urls import url

from wagtail.images.views.serve import SendFileView, ServeView
from wagtail.tests import dummy_sendfile_backend

urlpatterns = [
    url(r'^actions/serve/(.*)/(\d*)/(.*)/[^/]*', ServeView.as_view(action='serve'), name='wagtailimages_serve_action_serve'),
    url(r'^actions/redirect/(.*)/(\d*)/(.*)/[^/]*', ServeView.as_view(action='redirect'), name='wagtailimages_serve_action_redirect'),
    url(r'^custom_key/(.*)/(\d*)/(.*)/[^/]*', ServeView.as_view(key='custom'), name='wagtailimages_serve_custom_key'),
    url(r'^sendfile/(.*)/(\d*)/(.*)/[^/]*', SendFileView.as_view(), name='wagtailimages_sendfile'),
    url(r'^sendfile-dummy/(.*)/(\d*)/(.*)/[^/]*', SendFileView.as_view(backend=dummy_sendfile_backend.sendfile), name='wagtailimages_sendfile_dummy'),
]
Ejemplo n.º 12
0
    url(r'^accounts/', include('allauth.urls')),
    url(r'^admin/', include(wagtailadmin_urls)),
    url(r'^search/$', search_views.search, name='search'),
    url(r'^documents/', include(wagtaildocs_urls)),

    url('^sitemap.xml$', sitemap),
    url(r'^blog/feed/basic$', BasicFeed(), name='basic_feed'),
    url(r'^blog/feed/extended$', ExtendedFeed(), name='extended_feed'),

    # JSON feed
    url(r'^blog/feed/basic.json$', BasicJsonFeed(), name='basic_json_feed'),
    url(r'^blog/feed/extended.json$', ExtendedJsonFeed(), name='extended_json_feed'),

    url(
        r'^images/([^/]*)/(\d*)/([^/]*)/[^/]*$',
        ServeView.as_view(), name='wagtailimages_serve'
    ),
    # For anything not caught by a more specific rule above, hand over to
    # Wagtail's serving mechanism
    url(r'', include(wagtail_urls)),
]


if settings.DEBUG:
    from django.contrib.staticfiles.urls import staticfiles_urlpatterns
    from django.views.generic.base import RedirectView

    urlpatterns += staticfiles_urlpatterns()
    urlpatterns += static(settings.MEDIA_URL,
                          document_root=settings.MEDIA_ROOT)
    urlpatterns += [
Ejemplo n.º 13
0
from django.urls import re_path

from wagtail.images.views.serve import SendFileView, ServeView
from wagtail.tests import dummy_sendfile_backend

urlpatterns = [
    # Format: signature, image_id, filter_spec, filename=None
    re_path(
        r"^actions/serve/(.*)/(\d*)/(.*)/[^/]*",
        ServeView.as_view(action="serve"),
        name="wagtailimages_serve_action_serve",
    ),
    re_path(
        r"^actions/redirect/(.*)/(\d*)/(.*)/[^/]*",
        ServeView.as_view(action="redirect"),
        name="wagtailimages_serve_action_redirect",
    ),
    re_path(
        r"^custom_key/(.*)/(\d*)/(.*)/[^/]*",
        ServeView.as_view(key="custom"),
        name="wagtailimages_serve_custom_key",
    ),
    re_path(
        r"^custom_view/([^/]*)/(\d*)/([^/]*)/[^/]*$",
        ServeView.as_view(),
        name="wagtailimages_serve_custom_view",
    ),
    re_path(
        r"^sendfile/(.*)/(\d*)/(.*)/[^/]*",
        SendFileView.as_view(),
        name="wagtailimages_sendfile",
    url(r'^admin/', include(wagtailadmin_urls)),
    url(r'^search/$', search_views.search, name='search'),
    url(r'^documents/', include(wagtaildocs_urls)),

    url('^sitemap\.xml$', sitemap),
    url(r'^blog/feed/basic$', BasicFeed(), name='basic_feed'),
    url(r'^blog/feed/extended$', ExtendedFeed(), name='extended_feed'),

    # JSON feed
    url(r'^blog/feed/basic.json$', BasicJsonFeed(), name='basic_json_feed'),
    url(r'^blog/feed/extended.json$', ExtendedJsonFeed(), name='extended_json_feed'),

    url(
        r'^images/([^/]*)/(\d*)/([^/]*)/[^/]*$',
        ServeView.as_view(), name='wagtailimages_serve'
    ),
    # For anything not caught by a more specific rule above, hand over to
    # Wagtail's serving mechanism
    url(r'', include(wagtail_urls)),
]


if settings.DEBUG:
    from django.contrib.staticfiles.urls import staticfiles_urlpatterns
    from django.views.generic.base import RedirectView

    urlpatterns += staticfiles_urlpatterns()
    urlpatterns += static(settings.MEDIA_URL,
                          document_root=settings.MEDIA_ROOT)
    urlpatterns += [
Ejemplo n.º 15
0
if settings.DEBUG:
    urlpatterns = [
        url(r"^__debug__/", include(debug_toolbar.urls)),
    ]
else:
    urlpatterns = []
urlpatterns += [
    url(r"^admin/", admin.site.urls),
    url(r"^accounts/", include("allauth.urls")),
    url(r"^api/", include("conf_site.api.urls")),
    url(r"^cms/", include(wagtailadmin_urls)),
    url(r"^dashboard/", symposion.views.dashboard, name="dashboard"),
    url(r"^documents/", include(wagtaildocs_urls)),
    url(
        r"^images/([^/]*)/(\d*)/([^/]*)/[^/]*$",
        WagtailImageView.as_view(action="redirect"),
        name="wagtailimages_serve",
    ),
    url(r"^speaker/export/$",
        staff_member_required(ExportAcceptedSpeakerEmailView.as_view()),
        name="speaker_email_export"),
    url(r"^speaker/list/$", SpeakerListView.as_view(), name="speaker_list"),
    path(
        "speaker/profile/<int:pk>/",
        SpeakerRedirectView.as_view(),
        name="speaker_profile_redirect",
    ),
    path(
        "speaker/profile/<int:pk>/<slug:slug>/",
        SpeakerDetailView.as_view(),
        name="speaker_profile",