urls.py 1.5 KB

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