urls.py 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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),
  16. url(r'^moment-i18n.js$', momentjs_catalog),
  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. # Uncomment next line if you plan to use browseable API
  20. #url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework'))
  21. ]
  22. urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
  23. urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
  24. # Error Handlers
  25. # Misago needs those handlers to deal with errors raised by it's middlewares
  26. # If you replace those handlers with custom ones, make sure you decorate them
  27. # functions with shared_403_exception_handler or shared_404_exception_handler
  28. # decorators that are defined in misago.views.errorpages module!
  29. handler403 = 'misago.core.errorpages.permission_denied'
  30. handler404 = 'misago.core.errorpages.page_not_found'