"""myproject URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.8/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') Including another URLconf 1. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ from django.conf.urls import include, url from django.contrib import admin from share.views import HomeView, DisplayView, MyView, SearchView urlpatterns = [ url(r'^admin/', include(admin.site.urls)), url(r'^$', HomeView.as_view()), url(r'^s/(?P<code>\d+)/$', DisplayView.as_view()), url(r'^my/$', MyView.as_view(), name='MY'), url(r'^search/$', SearchView.as_view(), name='search'), ]
The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.0/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.conf.urls import include,url from django.contrib import admin from share.views import HomeView,DisplayView,MyView,SearchView,delFile,AllView from django.urls import path urlpatterns = [ url('^admin/', admin.site.urls), url(r'^$',HomeView.as_view(), name="home"), url(r'^s/(?P<code>\d+)/$',DisplayView.as_view()),#即匹配127.0.0.1:9000/s/15156.../这样的请求,?P<code>只是给那个组命名 url(r'^my/$',MyView.as_view(),name="MY"), url(r'^all/$',AllView.as_view(),name="All"), url(r'^search/',SearchView.as_view(),name="search"), path('delFile',delFile,name='delFile'), # path('testApi',testApi,name='testApi'), ]
"""file_share URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.0/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path from share.views import HomeView, DisplayView, MyView, SearchView urlpatterns = [ path('admin/', admin.site.urls), path('', HomeView.as_view(), name='home'), path('my/', MyView.as_view(), name='MY'), path('search/', SearchView.as_view(), name='search'), path('s/<str:code>/', DisplayView.as_view()), ]
"""myproject URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ from django.conf.urls import url, include from django.contrib import admin from share.views import HomeView, DisplayView, MyView, SearchView urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$', HomeView.as_view(), name='home'), #因为是以对象的形式去调用视图,必须要加括号,而不是 as_view url(r'^f/(?P<code>\d+)/$', DisplayView.as_view(), name='display'), url(r'^my/$', MyView.as_view(), name='my'), url(r'^search/', SearchView.as_view(), name='search') ]
from django.contrib import admin from django.urls import path,include from share.views import HomeView, DisplayView, MyView, SearchView,RegisterView,IndexView,down_file urlpatterns = [ path('admin/', admin.site.urls), path('index/',IndexView.as_view(),name='index'), path('home/', HomeView.as_view(), name='home'), path('s/<code>', DisplayView.as_view(), name='display'), path('my/', MyView.as_view(), name='my'), path('download/<code>',down_file,name='download'), path('search/', SearchView.as_view(), name='search'), path('',RegisterView.as_view(),name='register'), path('',include('django.contrib.auth.urls')), ]