urls.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. from django.conf import settings
  2. from django.conf.urls import include, url
  3. # Serve static and media files in development
  4. from django.conf.urls.static import static
  5. # Setup Django admin to work with Misago auth
  6. from django.contrib import admin
  7. # Register default views
  8. from misago.core.views import javascript_catalog, momentjs_catalog
  9. from misago.users.forms.auth import AdminAuthenticationForm
  10. admin.autodiscover()
  11. admin.site.login_form = AdminAuthenticationForm
  12. urlpatterns = [
  13. url(r'^', include('misago.urls', namespace='misago')),
  14. # Javascript translations
  15. url(r'^django-i18n.js$', javascript_catalog, name='django-i18n'),
  16. url(r'^moment-i18n.js$', momentjs_catalog, name='moment-i18n'),
  17. # Uncomment next line if you plan to use Django admin for 3rd party apps
  18. #url(r'^django-admin/', include(admin.site.urls)),
  19. ]
  20. # If debug mode is enabled, run debug toolbar
  21. if settings.DEBUG:
  22. import debug_toolbar
  23. urlpatterns += [
  24. url(r'^__debug__/', include(debug_toolbar.urls)),
  25. ]
  26. # Use static file server for static and media (debug only)
  27. urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
  28. urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
  29. # Error Handlers
  30. # Misago needs those handlers to deal with errors raised by it's middlewares
  31. # If you replace those handlers with custom ones, make sure you decorate them
  32. # functions with shared_403_exception_handler or shared_404_exception_handler
  33. # decorators that are defined in misago.views.errorpages module!
  34. handler403 = 'misago.core.errorpages.permission_denied'
  35. handler404 = 'misago.core.errorpages.page_not_found'