urls.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. from django.urls import include, path, re_path
  2. from wagtail.contrib.sitemaps.views import sitemap
  3. from wagtail import urls as wagtailcore_urls
  4. from coderedcms.settings import crx_settings
  5. from coderedcms.views import (
  6. event_generate_ical_for_calendar,
  7. event_generate_recurring_ical_for_event,
  8. event_generate_single_ical_for_event,
  9. event_get_calendar_events,
  10. favicon,
  11. robots,
  12. serve_protected_file,
  13. )
  14. urlpatterns = [
  15. # CodeRed custom URLs
  16. path(r"favicon.ico", favicon, name="crx_favicon"),
  17. path(r"robots.txt", robots, name="crx_robots"),
  18. path(r"sitemap.xml", sitemap, name="crx_sitemap"),
  19. re_path(
  20. r"^{0}(?P<path>.*)$".format(
  21. crx_settings.CRX_PROTECTED_MEDIA_URL.lstrip("/")
  22. ),
  23. serve_protected_file,
  24. name="serve_protected_file",
  25. ),
  26. # Event/Calendar URLs
  27. path(
  28. "ical/generate/single/",
  29. event_generate_single_ical_for_event,
  30. name="event_generate_single_ical",
  31. ),
  32. path(
  33. "ical/generate/recurring/",
  34. event_generate_recurring_ical_for_event,
  35. name="event_generate_recurring_ical",
  36. ),
  37. path(
  38. "ical/generate/calendar/",
  39. event_generate_ical_for_calendar,
  40. name="event_generate_ical_for_calendar",
  41. ),
  42. path(
  43. "ajax/calendar/events/",
  44. event_get_calendar_events,
  45. name="event_get_calendar_events",
  46. ),
  47. # Wagtail
  48. path("", include(wagtailcore_urls)),
  49. ]