from django.urls import path from user.views import Register, Profile, UserLogin urlpatterns = [ path('register/', Register.as_view()), path('manage/', Profile.as_view()), path('login/', UserLogin.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 user.views import Register, Logout, Login from rest_framework.authtoken import views app_name = 'user' urlpatterns = [ path('register/', Register.as_view(), name="register"), path('login/', Login.as_view(), name='login'), path('logout/', Logout.as_view(), name='logout') ]
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)) ]
"""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 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"), ]
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.urls import path from rest_framework_jwt.views import obtain_jwt_token from user.views import Register, Detail, Update, CountOnline urlpatterns = [ path('login/', obtain_jwt_token, name='login'), path('register/', Register.as_view(), name='register'), path('detail/', Detail.as_view(), name='detail'), path('update/', Update.as_view(), name='update'), path('online/', CountOnline.as_view(), name='count_online') ]
from django.urls import path from rest_framework_simplejwt.views import TokenObtainPairView from user.views import Register, ChangeInfo urlpatterns = [ path('sign-up/', Register.as_view(), name='reg'), # path('sign-in/', Login.as_view(), name='login'), path('sign-in/', TokenObtainPairView.as_view(), name='token_obtain_pair'), path('change/', ChangeInfo.as_view(), name='change'), ]
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"), ]