Python Galery
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

urls.py 1.2KB

1234567891011121314151617181920212223242526272829303132
  1. """Project URL Configuration
  2. The `urlpatterns` list routes URLs to views. For more information please see:
  3. https://docs.djangoproject.com/en/2.2/topics/http/urls/
  4. Examples:
  5. Function views
  6. 1. Add an import: from my_app import views
  7. 2. Add a URL to urlpatterns: path('', views.home, name='home')
  8. Class-based views
  9. 1. Add an import: from other_app.views import Home
  10. 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
  11. Including another URLconf
  12. 1. Import the include() function: from django.urls import include, path
  13. 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
  14. """
  15. from django.conf import settings
  16. from django.conf.urls.static import static
  17. from django.contrib import admin
  18. from django.shortcuts import redirect
  19. from django.urls import path, include
  20. from django.urls.base import reverse
  21. import pygal
  22. urlpatterns = [
  23. path('admin/', admin.site.urls),
  24. path('pygal/', include('pygal.urls')),
  25. path('users/', include('users.urls')),
  26. path('', lambda request: redirect(reverse('pygal-responses', kwargs={'responsetype': pygal.RESP_TYPE_USERVIEW, 'datatype': pygal.DATA_TYPE_ITEM}), permanent=False)),
  27. ]
  28. if settings.DEBUG:
  29. urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)