urls.py 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. """
  2. URL configuration for system project.
  3. The `urlpatterns` list routes URLs to views. For more information please see:
  4. https://docs.djangoproject.com/en/4.2/topics/http/urls/
  5. Examples:
  6. Function views
  7. 1. Add an import: from my_app import views
  8. 2. Add a URL to urlpatterns: path('', views.home, name='home')
  9. Class-based views
  10. 1. Add an import: from other_app.views import Home
  11. 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
  12. Including another URLconf
  13. 1. Import the include() function: from django.urls import include, path
  14. 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
  15. """
  16. from django.conf.urls.static import static
  17. from django.contrib import admin
  18. from django.urls import path, include
  19. from django.views.static import serve
  20. from blog import views
  21. from blog.controller import login
  22. from system import settings
  23. from django.urls import re_path as url
  24. urlpatterns = [
  25. path('user_avatar/<pk>', views.avatar), # login_view is the custom login view ,
  26. path('admin/login/', login.login, name='new_admin_login'), # login_view is the custom login view ,
  27. path('admin/', admin.site.urls),
  28. path('', views.index,name='index'),
  29. path('index', views.index),
  30. path('category/', include('blog.router.category_url.category_url')),
  31. path('article/', include('blog.router.article_url.article_url')),
  32. path('date/<date>',views.current_record),
  33. path('login', login.login),
  34. path('logout', login.logout),
  35. path('tag/', include('blog.router.tag_url.tag_url')),
  36. path('management/', include('blog.router.admin_url.admin_url')),
  37. path('avatar/', include('avatar.urls')),
  38. url(r'^upload/files/(?P<path>.*)$', serve, {'document_root': settings.UPLOAD_ROOT})
  39. ] + static('/avatars', document_root=settings.AVATAR_DIR)