urls.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. # In-dev preload data for Ember-CLI
  14. url(r'^misago-preload-data.js$', 'misago.core.views.preload_data'),
  15. # Uncomment next line if you plan to use Django admin for 3rd party apps
  16. #url(r'^django-admin/', include(admin.site.urls)),
  17. # Uncomment next line if you plan to use browseable API
  18. #url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework'))
  19. )
  20. # Serve static and media files in development
  21. from django.conf.urls.static import static
  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'