from django.conf import settings from django.conf.urls.static import static from django.contrib import admin from django.urls import path from post.views import PostListCreate, PostDetailUpdateDelete, CommentCreate, CommentDelete, PostLike from user.views import Login, SignUp, UserUpdate, UserFollow, UserProfile, Search urlpatterns = [ path('admin/', admin.site.urls), path('search', Search.as_view()), path('post', PostListCreate.as_view()), path('post/<int:post_id>', PostDetailUpdateDelete.as_view()), path('post/<int:post_id>/like', PostLike.as_view()), path('auth', Login.as_view()), path('signup', SignUp.as_view()), path('user/<int:user_id>', UserUpdate.as_view()), path('user/<int:user_id>/detail', UserProfile.as_view()), path('user/<int:user_id>/follow', UserFollow.as_view()), path('comment', CommentCreate.as_view()), path('comment/<int:comment_id>', CommentDelete.as_view()) ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
path('create-product', createProduct, name='create-product'), #Update Product path('update-product/<str:pk>/', updateProduct, name='update-product'), #Delete Product path('delete-product/<str:pk>/', deleteProduct, name='delete-product'), #Add Photo path('create-photo/<str:pk>', createColorPhoto, name='create-photo'), #Update Photo path('update-photo/<str:pk>', updateColorPhoto, name='update-photo'), #Delete ProductColor path('delete-pcolor/<str:pk>', deleteProductColor, name='delete-pcolor'), #Add SKU #Detail-SKU path('create-sku/<int:pk_one>/<int:pk_two>', createProductSku, name='create-sku'), #Update SKU path('update-sku/<slug>', updateSku, name='update-sku'), #Delete SKU path('delete-sku/<slug>', deleteSku, name='delete-sku'), #LOGIN path('accounts/login/', Login.as_view(), name='login'), #LOGOUT path('logout', login_required(logoutUser), name='logout') ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
from django.urls import path from user.views import RegisterView, index, Login, LogoutUser, ActiveView from django.conf.urls import url app_name = 'user' urlpatterns = [ path('register/', RegisterView.as_view(), name='register'), # path('register/', views.register.as_view(), name='register'), path('index/', index, name='index'), path('login/', Login.as_view(), name='login'), path('logout', LogoutUser.as_view(), name='logout'), # url(r'^active/(.*)$', ActiveView.as_view, name='active') path('active/<str:token>', ActiveView.as_view, name='active') # 用户激活 ]
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, re_path from core.views import CourseAddView, CourseList, CourseView, Index, TeacherView from report.views import ReportIndex from user.views import Login, Logout, RefreshCookies urlpatterns = [ path('admin/', admin.site.urls), path('', Index.as_view()), path('course_list/', CourseList.as_view()), path('login/', Login.as_view()), path('logout/', Logout.as_view()), path('teacher/', TeacherView.as_view()), path('course/', CourseAddView.as_view()), path('course/<int:course_id>/', CourseView.as_view()), path('report/', ReportIndex.as_view()), re_path(r'^report/*$', ReportIndex.as_view()), # 会有人访问 /// 这样的坑爹路径 path('refresh_cookies/', RefreshCookies.as_view()), ]
from django.conf.urls import url from user.views import Register, Index, About, Login, Active, Logout urlpatterns = [ url(r'^register$', Register.as_view(), name='register'), url(r'^active/(?P<token>.*)$', Active.as_view(), name='active'), url(r'^login$', Login.as_view(), name='login'), url(r'^logout', Logout.as_view(), name='logout'), url(r'^about$', About.as_view(), name='about'), url(r'^index$', Index.as_view(), name='index'), url(r'^$', Index.as_view(), name='index'), ]
from django.urls import path from django.views.generic import TemplateView from user import views from django.conf.urls import url from .settings import MEDIA_ROOT from django.views.static import serve from django.conf.urls.static import static from django.conf import settings from django.urls import include from user.views import LoginView, RegisterView, ActiveView, Login, ModifyView, ForgetPwdView, ResetView, Modify, contact, ChangeInfo, Message, changeimage from bloginfo.views import AddView, DeleteView, EditView, EditAddView, get_blogs, get_details, search, EditInfo, getPerson urlpatterns = [ path('admin/', admin.site.urls), # path('', TemplateView.as_view(template_name="home.html"), name='login'), path('', Login.as_view(), name='home'), url('captcha/', include("captcha.urls")), url(r'^tinymce/', include('tinymce.urls')), path('register', RegisterView.as_view(), name="register"), url(r'^reset/(?P<active_code>.*)/$', ResetView.as_view(), name='reset_wpd'), url(r'^modify_pwd/$', ModifyView.as_view(), name='modify_pwd'), url(r'^active/(?P<active_code>.*)/$', ActiveView.as_view(), name='user_active'), url('login', LoginView.as_view(), name='user_login'), path('logout', views.logoutView, name='logout'), path('forgetpwd', ForgetPwdView.as_view(), name='forgetpwd'), path('addBlog', AddView.as_view(), name='addblog'), path('blogList', get_blogs, name='index'), path('modify', Modify.as_view(), name='modify'),
from django.conf.urls import url,include from django.contrib import admin from user.views import Login,Register,UserList,Order,UserDetailView,UserListView,UserGenericAPIView # 自动路由匹配 from rest_framework.routers import DefaultRouter router = DefaultRouter() #注册路由 router.register(r'userlist',UserListView) urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^(?P<version>[v1|v2]+)/register/', Register.as_view()), url(r'^(?P<version>[v1|v2]+)/login/', Login.as_view()), # url(r'^(?P<version>[v1|v2]+)/userlist/', UserList.as_view()), # url(r'^(?P<version>[v1|v2]+)/userdetail/(?P<pk>\d+)/', UserDetailView.as_view(),name='userdetail'), # # url(r'^(?P<version>[v1|v2]+)/userdetail/\d+/', UserDetailView.as_view()), # url(r'^(?P<version>[v1|v2]+)/userlist111/$', UserList.as_view(),name='userlist'), # url(r'^(?P<version>[v1|v2]+)/users/$', UserList.as_view()), # url(r'^(?P<version>[v1|v2]+)/order/$', Order.as_view()), # 不使用自动路由匹配 URL编写方式 url(r'^(?P<version>[v1|v2]+)/genuser/$',UserGenericAPIView.as_view({'get':'list'})), # url(r'^(?P<version>[v1|v2]+)/userlist/$', UserListView.as_view({'get':'list','post':'create'})), # url(r'^(?P<version>[v1|v2]+)/userlist/(?P<pk>\d+)/$', UserListView.as_view({'get':'retrieve','delete':'destroy','put':'update'})), url(r'^(?P<version>[v1|v2]+)/',include(router.urls)) ]
from django.conf.urls import url from user.views import Login, Logout, Register urlpatterns = [ url(r'^login/$', Login.as_view(), name="login"), url(r'^logout/$', Logout.as_view(), name="logout"), url(r'^register/$', Register.as_view(), name="register"), ]
"""zhuce_denglu 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 from django.contrib import admin from user.views import Login,Register,UserList urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^register/', Register.as_view()), url(r'^login/', Login.as_view()), url(r'^userlist/', UserList.as_view()), ]
from django.conf.urls import url, include from django.urls import path from user.views import Login, Logout, Register, ForgetPwd, UserInfoModelMixin urlpatterns = [ url(r'login/$', Login.as_view(), name='login'), url(r'logout/$', Logout.as_view(), name='login'), url(r'register/$', Register.as_view({'post': 'create'}), name='register'), url(r'forget/$', ForgetPwd.as_view(), name='forget'), url(r'info/(?P<pk>\d+)/$', UserInfoModelMixin.as_view({'get': 'retrieve', 'put': 'update'}), name='info'), ]
from django.conf.urls.static import static from django.contrib import admin from django.urls import path, re_path, include from user.views import Register, Active, Login, EditUserInfo, Logout, ForgetPassword from blog_system.views import Index from rest_framework.routers import DefaultRouter from blog.apis import PostViewSet, CategoryViewSet import xadmin router = DefaultRouter() router.register(r'post', PostViewSet, base_name='api-post') router.register(r'category', CategoryViewSet, base_name='api-category') urlpatterns = [ re_path(r'^$', Index.as_view(), name="index"), path(r'api/', include(router.urls)), path(r'admin/', admin.site.urls), path(r'xadmin/', xadmin.site.urls, name="xadmin"), path(r'register', Register.as_view(), name="register"), path(r'active/<str:code>', Active.as_view(), name="active"), path(r'login/', Login.as_view(), name="login"), path(r'logout/', Logout.as_view(), name="logout"), path(r'forget-password/', ForgetPassword.as_view(), name="forget-password"), path(r'edit_info/', EditUserInfo.as_view(), name="edit_info"), path(r'<str:auth>/', include('blog.urls')), path(r'nav/', include('blog_system.urls')), path(r'comment/', include('comment.urls')), path(r'mdeditor/', include('mdeditor.urls')), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
https://docs.djangoproject.com/en/3.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 import xadmin from user.views import Register, Login from .view import Index from . import view urlpatterns = [ path('xadmin/', xadmin.site.urls), path('hello/<int:bookid>',view.hello), path("datetime/",view.current_datetime), path('sende',view.sendemail), path("index",Index.as_view(),name="index"), path("register",Register.as_view(),name="register"), path('login',Login.as_view(),name="login"), ]