urls.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. """
  2. Definition of urls for DjangoWebProject1.
  3. """
  4. from datetime import datetime
  5. from django.conf.urls import url
  6. import django.contrib.auth.views
  7. import app.forms
  8. import app.views
  9. # Uncomment the next lines to enable the admin:
  10. # from django.conf.urls import include
  11. # from django.contrib import admin
  12. # admin.autodiscover()
  13. urlpatterns = [
  14. # Examples:
  15. url(r'^$', app.views.home, name='home'),
  16. url(r'^contact$', app.views.contact, name='contact'),
  17. url(r'^about$', app.views.about, name='about'),
  18. url(r'^login/$',
  19. django.contrib.auth.views.login,
  20. {
  21. 'template_name': 'app/login.html',
  22. 'authentication_form': app.forms.BootstrapAuthenticationForm,
  23. 'extra_context':
  24. {
  25. 'title': 'Log in',
  26. 'year': datetime.now().year,
  27. }
  28. },
  29. name='login'),
  30. url(r'^logout$',
  31. django.contrib.auth.views.logout,
  32. {
  33. 'next_page': '/',
  34. },
  35. name='logout'),
  36. # Uncomment the admin/doc line below to enable admin documentation:
  37. # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
  38. # Uncomment the next line to enable the admin:
  39. # url(r'^admin/', include(admin.site.urls)),
  40. ]