urls.py 1.5 KB

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