from django.conf.urls import url from django.conf import settings from django.views.generic.base import TemplateView from rest_auth.views import (LoginView, LogoutView, UserDetailsView, PasswordChangeView, PasswordResetView, PasswordResetConfirmView) from rest_auth.registration.views import (RegisterView, VerifyEmailView) from .views import FacebookLogin urlpatterns = [ # URLs that do not require a session or valid token url(r'^auth/login/$', LoginView.as_view(), name='rest_login'), url(r'^auth/password/reset/$', PasswordResetView.as_view(), name='rest_password_reset'), url(r'^auth/password/reset/confirm/$', PasswordResetConfirmView.as_view(), name='rest_password_reset_confirm'), # URLs that require a user to be logged in with a valid session / token. url(r'^auth/logout/$', LogoutView.as_view(), name='rest_logout'), url(r'^auth/user/$', UserDetailsView.as_view(), name='rest_user_details'), url(r'^auth/password/change/$', PasswordChangeView.as_view(), name='rest_password_change'), url(r'^auth/registration/$', RegisterView.as_view(), name='rest_register'), url(r'^auth/registration/verify-email/$', VerifyEmailView.as_view(), name='rest_verify_email'), url(r'^auth/account-confirm-email/(?P<key>[-:\w]+)/$', TemplateView.as_view(),
rest.ProjectMessagesViewSet, base_name="messages") results_router = NestedDefaultRouter(projects_router, "series", lookup="series", trailing_slash=True) results_router.include_format_suffixes = False results_router.register("results", rest.SeriesResultsViewSet, base_name="results") schema_view = get_schema_view(title="API schema") urlpatterns = _build_urls() dispatch_module_hook("api_url_hook", urlpatterns=urlpatterns) urlpatterns += [ url( r"^v1/projects/by-name/(?P<name>[^/]*)(?P<tail>/.*|$)", rest.ProjectsByNameView.as_view(), ), url(r"^v1/users/login/$", LoginView.as_view(), name="rest_login"), url(r"^v1/users/logout/$", LogoutView.as_view(), name="rest_logout"), url(r"^v1/", include(router.urls)), url(r"^v1/", include(projects_router.urls)), url(r"^v1/", include(results_router.urls)), url(r"^v1/schema/$", schema_view), # Use the base class's handler by default url(r".*", views.APIView.as_view()), ]
from django.conf.urls import include from django.conf.urls.static import static from django.contrib import admin from django.urls import path from .views import HomeTemplateView, TestAuthView, LogoutViewEx from rest_auth.views import LoginView urlpatterns = [ path('admin/', admin.site.urls), path( 'test_auth/', TestAuthView.as_view(), name='test_auth', ), path( 'rest-auth/logout/', LogoutViewEx.as_view(), name='rest_logout', ), path( 'rest-auth/login/', LoginView.as_view(), name='rest_login', ), path( '', HomeTemplateView.as_view(), name='home', ), ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
from django.urls import path, re_path, include from rest_auth.registration.views import RegisterView, VerifyEmailView, ConfirmEmailView from rest_auth.views import LoginView, LogoutView, PasswordResetView, PasswordResetConfirmView from .views import * from .admin_views import * urlpatterns = [ #path('signup/',SignUpView.as_view()), path('account-confirm-email/<str:key>/', ConfirmEmailView.as_view()), path('signup/', RegisterView.as_view()), path('login/', LoginView.as_view()), path('logout/', LogoutView.as_view()), path('verify-email/', VerifyEmailView.as_view(), name='rest_verify_email'), path('account-confirm-email/', VerifyEmailView.as_view(), name='account_email_verification_sent'), re_path(r'^account-confirm-email/(?P<key>[-:\w]+)/$', VerifyEmailView.as_view(), name='account_confirm_email'), path('password-reset/', PasswordResetView.as_view()), path('password-reset-confirm/<uidb64>/<token>/', PasswordResetConfirmView.as_view(), name='password_reset_confirm'), path('profile/', UserProfileView.as_view()), path('user-status/', UserStatusView.as_view()), path('new-post/', post_create_view), path('post-list/', PostListView.as_view()), path('update-post/', post_update_view), path('delete-post/', post_delete_view), ]
from rest_auth.views import LoginView from rest_auth.registration.views import RegisterView from django.urls import path from django.conf.urls import include, url from django.views.decorators.csrf import csrf_exempt urlpatterns = [ # path('', include('rest_auth.urls')), # path('registration/', include('rest_auth.registration.urls')), path("api-login/", csrf_exempt(LoginView.as_view()), name="api-login"), path("api-register/", csrf_exempt(RegisterView.as_view()), name="api-register"), url(r'^rest-auth/', include('rest_auth.urls')), url(r'^rest-auth/registration/', include('rest_auth.registration.urls')), ]
from django.urls import path, include from django.views.generic import TemplateView from rest_auth.views import ( LoginView, PasswordResetView, PasswordResetConfirmView, PasswordChangeView, LogoutView ) from rest_auth.registration.views import RegisterView, VerifyEmailView from rest_framework.routers import DefaultRouter from . import views router = DefaultRouter() router.register('client', views.ClientView) urlpatterns = [ path('', include(router.urls)), path('rest-auth/', include('rest_auth.urls')), path('registration/', include('rest_auth.registration.urls')), path('login/', LoginView.as_view(), name='account_login'), path('logout/', LogoutView.as_view(), name='rest_logout'), path('accounts/', include('allauth.urls')), path('delete-account/', views.DeleteAccount.as_view()), ]
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.conf import settings from django.conf.urls.static import static from django.contrib import admin from django.urls import path, include from rest_auth.views import LoginView from core.views import BankAPIView, CreateBankAPIView, CustomerAPIView, CreateCustomerAPIView, ContractAPIView, \ CreateContractAPIView, PaymentAPIView, CreatePaymentAPIView urlpatterns = [ path('accounts/', include('allauth.urls')), path('admin/', admin.site.urls), path('api/', include('rest_framework.urls')), path('login/', LoginView.as_view(), name='login'), # bank url's path('list/bank/', BankAPIView.as_view(), name='list-bank'), path('create/bank/', CreateBankAPIView.as_view(), name='create-bank'), # customer url's path('list/customer/', CustomerAPIView.as_view(), name='list-customer'), path('create/customer/', CreateCustomerAPIView.as_view(), name='create-customer'), # contract url's path('list/contract/', ContractAPIView.as_view(), name='list-contract'), path('create/contract/', CreateContractAPIView.as_view(),
from django.conf.urls import patterns, url from rest_auth.views import ( LoginView, LogoutView, UserDetailsView, PasswordChangeView, PasswordResetView, PasswordResetConfirmView, ) urlpatterns = patterns( "", # URLs that do not require a session or valid token url(r"^password/reset", PasswordResetView.as_view(), name="rest_password_reset"), url(r"^confirm/password/reset", PasswordResetConfirmView.as_view()), # url(r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', 'django.contrib.auth.views.password_reset_confirm', name='password_reset_confirm'), url( r"^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$", PasswordResetConfirmView.as_view(), name="password_reset_confirm", ), url(r"^login", LoginView.as_view(), name="rest_login"), # URLs that require a user to be logged in with a valid session / token. url(r"^logout", LogoutView.as_view(), name="rest_logout"), url(r"^user/$", UserDetailsView.as_view(), name="rest_user_details"), url(r"^password/change", PasswordChangeView.as_view(), name="rest_password_change"), )
routes = getattr(settings, 'REACT_ROUTES', []) urlpatterns = [ # path('admin/', admin.site.urls), #REACT로 만든 index.html 게시글 접근 # path('', TemplateView.as_view(template_name='index.html'),name='index'), #REACT ROUTER 역할 처럼 다시 들어올수 있도록 설정하기 url(r'^(%s)?$' % '|'.join(routes), TemplateView.as_view(template_name="index.html"),name='index'), path('', include('board.urls')), path('accounts/', include('accounts.urls')), # path('api/token/', obtain_jwt_token), # path('api/token/verify/', verify_jwt_token), # path('api/token/refresh/', refresh_jwt_token), # path('api-auth/', include('rest_framework.urls')), #로그인 # path("rest-auth/", include('rest_auth.urls')), path('rest-auth/login', LoginView.as_view(), name='rest_login'), path('rest-auth/logout', LogoutView.as_view(), name='rest_logout'), path('rest-auth/user', UserDetailsView.as_view(), name='rest_user_details'), path('rest-auth/password/change', PasswordChangeView.as_view(), name='rest_password_change'), #회원가입 path("rest-auth/registration", include('rest_auth.registration.urls')), ] urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
from django.urls import path from rest_auth.views import LoginView, LogoutView from rest_framework.routers import DefaultRouter from .views import UserViewSet, CheckAuthView router = DefaultRouter() router.register('users', UserViewSet) urlpatterns = [ path('users/login/', LoginView.as_view()), path('users/logout/', LogoutView.as_view()), path('users/check-auth/', CheckAuthView().as_view()) ] urlpatterns += router.urls
response_serializer = RestAuthCommonResponseSerializer() class PasswordResetConfirmViewSchema(CustomAutoSchema): request_serializer = PasswordResetConfirmSerializer() response_serializer = RestAuthCommonResponseSerializer() class PasswordChangeViewSchema(CustomAutoSchema): request_serializer = PasswordChangeSerializer() response_serializer = RestAuthCommonResponseSerializer() urlpatterns = [ url(r'^login/$', LoginView.as_view(schema=LoginViewSchema()), name='rest_login'), url(r'^logout/$', LogoutView.as_view(schema=LogoutViewSchema()), name='rest_logout'), url(r'^password/reset/$', PasswordResetView.as_view(schema=PasswordResetViewSchema()), name='rest_password_reset'), url(r'^password/reset/confirm/$', PasswordResetConfirmView.as_view( schema=PasswordResetConfirmViewSchema()), name='rest_password_reset_confirm'), url(r'^password/change/$', PasswordChangeView.as_view(schema=PasswordChangeViewSchema()), name='rest_password_change'), ]
from django.urls import re_path from rest_auth.views import ( LoginView, LogoutView, UserDetailsView, PasswordChangeView, PasswordResetView, PasswordResetConfirmView ) urlpatterns = [ # URLs that do not require a session or valid token re_path(r'^password/reset/$', PasswordResetView.as_view(), name='rest_password_reset'), re_path(r'^password/reset/confirm/$', PasswordResetConfirmView.as_view(), name='rest_password_reset_confirm'), re_path(r'^login/$', LoginView.as_view(), name='rest_login'), # URLs that require a user to be logged in with a valid session / token. re_path(r'^logout/$', LogoutView.as_view(), name='rest_logout'), re_path(r'^user/$', UserDetailsView.as_view(), name='rest_user_details'), re_path(r'^password/change/$', PasswordChangeView.as_view(), name='rest_password_change'), ]
from .views import DashboardTemplateView from apps.user.api.api_rest import UserViewSet from apps.task.api.api_rest import TaskViewSet router = routers.DefaultRouter() router.register(r'users', UserViewSet) router.register(r'task', TaskViewSet) routerPublic = routers.DefaultRouter() urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^accounts/', include('allauth.urls')), url(r'^django-des/', include(des_urls)), # API url(r'^api/accounts/login/$', LoginView.as_view(), name='login'), url(r'^api/accounts/logout/$', LogoutView.as_view(), name='logout'), url(r'^api/accounts/register/$', RegisterView.as_view(), name='logout'), url(r'^api/', include(router.urls)), url(r'^api/public/', include(routerPublic.urls)), url(r'^docs/', include_docs_urls(title='API Doc skol', description="Status code: http://www.django-rest-framework.org/api-guide/status-codes/", public=True, permission_classes=[AllowAny])), url(r'', login_required(DashboardTemplateView.as_view())), ] if settings.DEBUG: urlpatterns = static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + urlpatterns
from rest_auth.views import LoginView from django.urls import path from .api import PostList, post_like, profile_follow, ProfileList, PostImagesList urlpatterns = [ #AUTH URLS path('api/login', LoginView.as_view()), #POST URLS path('api/posts', PostList.as_view()), path('api/post/like/<post_id>', post_like), path('api/posts/images/<profile_id>', PostImagesList.as_view()), #PROFILE URLS path('api/profiles', ProfileList.as_view()), path('api/profiles/follow/<profile_id>', profile_follow), path('api/profiles/unfollow/<profile_id>', profile_follow, {'follow':False}), ]
from django.contrib import admin from django.conf.urls import include, url from rest_auth.views import (LoginView,LogoutView,UserDetailsView, PasswordChangeView,PasswordResetView, PasswordResetConfirmView ) from django.views.decorators.csrf import csrf_exempt from django.views.generic import TemplateView, RedirectView # urlpatterns = [ # path('admin/', admin.site.urls), # ] urlpatterns = [ # url(r'^api/', include('rest_auth.urls')) url(r'login/', csrf_exempt(LoginView.as_view()),name='login'), url(r'logout/', LogoutView.as_view(),name='logout'), url(r'user/', UserDetailsView.as_view(),name='user_details'), url(r'password/change/',PasswordChangeView.as_view(),name='password_change'), url(r'password/reset/confirm/',PasswordResetConfirmView.as_view(),name='password_reset_confirm'), url(r'password/reset/',PasswordResetView.as_view(),name='password_reset') ]
https://docs.djangoproject.com/en/2.2/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, include, re_path from django.conf.urls import url from django.views.generic import TemplateView from rest_auth.views import LoginView from rest_auth.registration.views import RegisterView urlpatterns = [ path('api-auth/', include('rest_framework.urls')), path('rest-auth/login/', LoginView.as_view(), name="rest_login"), path('rest-auth/registration/', RegisterView.as_view(), name="rest_register"), path('admin/', admin.site.urls), path('accounts/', include('accounts.urls')), path('matches/', include('matches.urls')), url(r'^$', TemplateView.as_view(template_name='index.html')), ]
from django.urls import path from users.views import CreateUserAPIView, RetrieveUsernameAndColorAPIView from rest_auth.views import LoginView from rest_auth.views import LogoutView app_name = 'users' urlpatterns = [ path("create/", CreateUserAPIView.as_view(), name="user-create"), path("login/", LoginView.as_view(), name="user-login"), path("logout/", LogoutView.as_view(), name="user-logout"), path("me/", RetrieveUsernameAndColorAPIView.as_view(), name='user-me') ]
from rest_framework_jwt.views import verify_jwt_token from accounts import views as accountsView from accounts.views import UserDetailsView, account_login from chatrbaazan import settings from shop import serializers urlpatterns = [ url(r'^jet/', include('jet.urls', 'jet')), # Django JET URLS url(r'^jet/dashboard/', include('jet.dashboard.urls', 'jet-dashboard')), # Django JET dashboard URLS url(r'^ckeditor/', include('ckeditor_uploader.urls')), path('admin/', admin.site.urls), path('accounts/login/', account_login, name="account_login"), url(r'^', include('shop.urls')), path('auth/login/', LoginView.as_view()), path('auth/registration/', include('rest_auth.registration.urls')), re_path(r'^auth/account-confirm-email/', VerifyEmailView.as_view(), name='account_email_verification_sent'), url(r'^rest-auth/registration/account-confirm-email/(?P<key>[-:\w]+)/$', allauthemailconfirmation, name="account_confirm_email"), path('auth/refresh/', refresh_jwt_token), path('auth/verify/', verify_jwt_token), url(r'^auth/password/reset/$', accountsView.PasswordResetView.as_view(), name='rest_password_reset'), url(r'^auth/password/reset/confirm/(?P<uidb64>[0-9A-Za-z]+)-(?P<token>.+)/$', accountsView.PasswordResetConfirmView.as_view(), name='password_reset_confirm'),
from django.conf.urls import url from rest_auth.views import ( LoginView, LogoutView, UserDetailsView, PasswordChangeView, PasswordResetView, PasswordResetConfirmView ) urlpatterns = [ # URLs that do not require a session or valid token url(r'^password/reset$', PasswordResetView.as_view(), name='rest_password_reset'), url(r'^password/reset/confirm$', PasswordResetConfirmView.as_view(), name='rest_password_reset_confirm'), url(r'^login', LoginView.as_view(), name='rest_login'), # URLs that require a user to be logged in with a valid session / token. url(r'^logout$', LogoutView.as_view(), name='rest_logout'), url(r'^user$', UserDetailsView.as_view(), name='rest_user_details'), url(r'^password/change$', PasswordChangeView.as_view(), name='rest_password_change'), ]
) from .api import UserAPI router = routers.SimpleRouter() router.register(r"users", UserAPI) app_name = "users" rest_auth_overrides = [ # URLs that do not require a session or valid token path("password/reset/", PasswordResetView.as_view(), name="rest_password_reset"), path( "password/reset/confirm/", PasswordResetConfirmView.as_view(), name="rest_password_reset_confirm", ), path("login/", LoginView.as_view(), name="rest_login"), # URLs that require a user to be logged in with a valid session / token. path("logout/", LogoutView.as_view(), name="rest_logout"), path("me/", UserDetailsView.as_view(), name="rest_user_details"), path("password/change/", PasswordChangeView.as_view(), name="rest_password_change"), ] urlpatterns = ( [path("register/", include("rest_auth.registration.urls"))] + rest_auth_overrides + router.urls )
from django.conf.urls import url from rest_auth.registration.views import RegisterView from rest_auth.views import LoginView from applications.accounts import views from applications.accounts.views import UserVerifyJWT, ChangePasswordView urlpatterns = [ url(r'^signup/', RegisterView.as_view(), name='account_signup'), url(r'^login/', LoginView.as_view(), name='account_login'), url(r'^change-password/', ChangePasswordView.as_view(), name='change_password'), url(r'^api-token-verify/', UserVerifyJWT.as_view()), url(r'^profile/$', views.UserProfileView.as_view(), name='user_profile'), url(r'^destroy/$', views.UserProfileDestroyView.as_view(), name='destroy') ]
def empty_view(request): return HttpResponse('') urlpatterns = [ # Inbuilt Endpoints path('admin/', admin.site.urls), # Rest Auth Endpoints path('authentication/password/reset/', PasswordResetView.as_view(), name='rest_password_reset'), path('authentication/password/reset/confirm/', PasswordResetConfirmView.as_view(), name='rest_password_reset_confirm'), path('authentication/login/', LoginView.as_view(), name='rest_login'), path('authentication/logout/', LogoutView.as_view(), name='rest_logout'), path('authentication/password/change/', PasswordChangeView.as_view(), name='rest_password_change'), # The following URL actually has no functionality. When sending an email to a user regarding their requested # password change, we need a url with the name 'password_reset_confirm' so that we can use it as a template to # create the actual URL that the user should be redirected to. This actual URL needs to point to the frontend, # not back to the Django backend. This pointing is done based on the 'Domain Name' you provide in the 'sites' # table. You can set the domain name by going to the admin panel and looking for the sites. Please refer to the # rest-auth documentation for more details. path('password-reset/<uidb64>/<token>/', empty_view, name='password_reset_confirm'),
from categories.models import Category from django.contrib import admin from django.urls import path from tasks.views import TaskView from categories.views import CategoryView from users.views import UserView from rest_auth.views import LoginView from rest_auth.registration.views import RegisterView urlpatterns = [ path('admin/', admin.site.urls), path('signin', LoginView.as_view(), name='rest_login'), path('signup', RegisterView.as_view(), name='rest_register'), path( 'user/<int:pk>', UserView.as_view({ 'get': 'retrieve', 'put': 'update', 'delete': 'destroy' })), path('task/create', TaskView.as_view({'post': 'create'})), path( 'task/<int:pk>', TaskView.as_view({ 'get': 'retrieve', 'put': 'update', 'delete': 'destroy' })), path('task>', TaskView.as_view({'get': 'list'})), path( 'category/<int:pk>',
PasswordChangeView) from rest_auth.registration.views import RegisterView from . import views urlpatterns = [ path('api/sign_s3/', views.SignS3View.as_view(), name='sign_s3'), path('api/recipes/', views.RecipeListCreate.as_view(), name='recipe_list_create'), path('api/recipes/<id>', views.RecipeRUD.as_view(), name='recipe_rud'), path('api/recipes/<id>/made/', views.MakeRecipeView.as_view(), name='recipe_make'), path('api/users/<id>/recipes/', views.UserRecipeListView.as_view(), name='user_recipes'), path('api/register/', RegisterView.as_view(), name='api_register'), path('api/login/', LoginView.as_view(), name='rest_login'), path('api/logout/', LogoutView.as_view(), name='rest_logout'), path('api/user/', UserDetailsView.as_view(), name='rest_user_details'), path('api/password/change/', PasswordChangeView.as_view(), name='rest_password_change'), path('api/password/reset/', include('django_rest_passwordreset.urls', namespace='password_reset')), url(r'^.*', TemplateView.as_view(template_name='ng/index.html'), name='home'), ]
from django.conf.urls import url from django.contrib import admin from django.urls import include from rest_framework_jwt.views import obtain_jwt_token, refresh_jwt_token, verify_jwt_token from rest_auth.views import LoginView, LogoutView from login.views import UserRegistration app_name = "login" urlpatterns = [ url(r'^register/$', UserRegistration.as_view(), name="register"), url(r'^login/$', LoginView.as_view(), name="login"), url(r'^logout/$', LogoutView.as_view(), name="logout"), ]
router.register(r'coupon', CouponViewSet, base_name='coupon') router.register(r'users', UserViewSet, base_name='user') router.register(r'userfavs', UserFavViewset, base_name="userfavs") urlpatterns = [ # rest-auth setting / Registration ##-------------------------rest-auth登入---------------------------------------------------------- # URLs that do not require a session or valid token url(r'^password/reset/$', PasswordResetView.as_view(), name='rest_password_reset'), url(r'^password/reset/confirm/$', PasswordResetConfirmView.as_view(), name='rest_password_reset_confirm'), url(r'^users/login/$', LoginView.as_view(), name='rest_login'), # URLs that require a user to be logged in with a valid session / token. url(r'^users/logout/$', LogoutView.as_view(), name='rest_logout'), url(r'^user/$', UserDetailsView.as_view(), name='rest_user_details'), url(r'^password/change/$', PasswordChangeView.as_view(), name='rest_password_change'), ##-------------------------rest-auth登入---------------------------------------------------------- #因為rest-auth預設使用allauth,所以要匯入allauth的url,才不會造成NoReverse的錯誤 url(r'^accounts/', include('allauth.urls')), #reset password 預設會用到django的admin管理網站,所以我們先匯入他測試看看 url(r'^', include('django.contrib.auth.urls')), url(r'^rest-auth/registration/', include('rest_auth.registration.urls')), path("", include(router.urls)),
from django.conf.urls import url from rest_framework.urlpatterns import format_suffix_patterns from rest_auth.views import (LoginView, LogoutView, UserDetailsView, PasswordChangeView, PasswordResetView, PasswordResetConfirmView) from . import views from rest_framework.authtoken import views as rest_framework_views from rest_framework import renderers urlpatterns = [ url(r'^login/$', LoginView.as_view(), name='login'), url(r'^logout/$', LogoutView.as_view(), name='rest_logout'), url(r'^register/$', views.CreateUserView.as_view(), name='create_user'), url(r'^keyword/$', views.StoreKeyword.as_view(), name='create_keyword'), ] urlpatterns = format_suffix_patterns(urlpatterns)
from api.game.views import GameViewSet, PlayerViewSet from django.conf.urls import include, url from django.contrib import admin from rest_auth.views import LoginView from rest_framework import routers API_VERSION = 1 router = routers.DefaultRouter() router.register(r'games', GameViewSet, base_name='api_games') router.register(r'players', PlayerViewSet, base_name='api_players') urlpatterns = [ url( 'v{0}/'.format(API_VERSION), include([ url(r'^admin/', admin.site.urls), url(r'^api/', include(router.urls)), url(r'^login/', LoginView.as_view()), ])), ]
login_view = swagger_auto_schema(operation_summary='Login a user', operation_description=''' Check the credentials and return the REST Token if the credentials are valid and authenticated. Calls Django Auth login method to register User ID in Django session framework. ''', operation_id='user-login', methods=['POST'], tags=['User Accounts'], security=[], responses={ status.HTTP_200_OK: LoginSerializer, status.HTTP_400_BAD_REQUEST: 'Username/Password is required.' })(LoginView.as_view()) logout_view = swagger_auto_schema( operation_summary='Logout authenticated user', operation_description=''' Logout an authenticated user by deleting the Token object assigned to the current User object. **Note:** It accepts/returns nothing. ''', operation_id='user-logout', methods=['GET', 'POST'], tags=['User Accounts'], responses={status.HTTP_200_OK: 'Successfully logged out.'})(LogoutView.as_view())
from django.urls import path, re_path from rest_auth.registration.views import VerifyEmailView from rest_auth.views import LoginView from apps.users.views import RegistrationView urlpatterns = [ path('signup/', RegistrationView.as_view(), name='account_signup'), path('sigin/', LoginView.as_view(), name="sigin"), re_path(r'^account-confirm-email/(?P<key>[-:\w]+)/$', VerifyEmailView.as_view(), name='account_confirm_email'), ]
from django.conf.urls import patterns, url from rest_auth import views from axes.decorators import watch_login from rest_auth.views import ( LoginView, LogoutView, UserDetailsView, PasswordChangeView, PasswordResetView, PasswordResetConfirmView ) urlpatterns = [ # URLs that do not require a session or valid token url(r'^password/reset/$', PasswordResetView.as_view(), name='rest_password_reset'), url(r'^password/reset/confirm/$', PasswordResetConfirmView.as_view(), name='rest_password_reset_confirm'), url(r'^login/$', LoginView.as_view(), name='rest_login'), # URLs that require a user to be logged in with a valid session / token. url(r'^logout/$', LogoutView.as_view(), name='rest_logout'), url(r'^user/$', UserDetailsView.as_view(), name='rest_user_details'), url(r'^password/change/$', PasswordChangeView.as_view(), name='rest_password_change'), url(r'^handlecsv/$',views.handlecsv,name='handlecsv'), ]
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 rest_auth.views import LoginView from app1.views import IndexTemplateView from app1.views import SignUp from app1.views import Logout from app2.views import Greeting from app3.views import Message from rest_framework.authtoken.views import obtain_auth_token from django.conf import settings from django.conf.urls.static import static urlpatterns = [ path('', IndexTemplateView.as_view(), name='index'), path('admin/', admin.site.urls), path('api/v1/user/signup/', SignUp.as_view(), name='signup'), path('api/v1/login/', LoginView.as_view(), name='login'), path('api/v1/logout/', Logout.as_view(), name='apilogout'), path('api/v1/greeting/', Greeting.as_view(), name='greeting'), path('api/v1/message/', Message.as_view(), name='message'), path('api/v1/api-token-auth/', obtain_auth_token, name='api_token_auth'), #pass parameter as username and password # if user is created it gives the token that we can use for app2 and app3 API ]+ static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)