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 import settings from django.conf.urls import url, include from django.conf.urls.static import static from django.contrib import admin from django.contrib.auth import views as auth_views from accounts.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"), url(r"^account/", include("accounts.urls")), url(r"^admin/", admin.site.urls), url(r"^author/", include("authors.urls")), url(r"^cabinet/", include("cabinets.urls")), url(r"^comments/", include("comments.urls")), url(r"^moderator/", include("moderator.urls")), # password reset url(r'^password_reset/$', auth_views.password_reset, { 'template_name': 'accounts/password_reset_form.html', 'html_email_template_name': 'accounts/password_reset_email.html', 'subject_template_name': 'accounts/password_reset_subject.txt' },
from django.urls import path from accounts.views import Login urlpatterns = [ path('login/', Login.as_view(),name="login"), ]
from django.conf.urls import url from django.urls import path from accounts.views import Login, Logout app_name = 'accounts' urlpatterns = [ # path('signup/', Signup.as_view(), name='signup'), path('login/', Login.as_view(), name='login'), path('logout/', Logout.as_view(), name='logout'), # path('employee_list/', EmployeeList.as_view(), name='employee_list'), #url(r'employee_detail/(?P<employee_id>[0-9]+)/$', EmployeeDetail.as_view(), name='employee_detail'), # path('employee_add/', EmployeeAdd.as_view(), name='employee_add'), #path('employee_edit/', EmployeeEdit.as_view(), name='employee_edit'), #path('employee_remove/', EmployeeRemove.as_view(), name='employee_remove'), #path('api/', getApi.as_view(), name='api'), ]
"""deli URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.1/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 accounts.views import Login, Protected urlpatterns = [ path('admin/', admin.site.urls), path('login/', Login.as_view()), path('protected/', Protected.as_view()) ]
'template_name': 'accounts/logout.html' } resetparams1 = { 'template_name' : 'accounts/password_reset.html', 'email_template_name': 'accounts/password_email.html', 'post_reset_redirect': '/password/reset/done/', 'password_reset_form': CustomPasswordResetForm, } resetparams2 = { 'post_reset_redirect': '/password/reset/complete/' } urlpatterns = patterns('', url(r'^login/$', Login.as_view(), name='login'), url(r'^logout/$', 'django.contrib.auth.views.logout', logoutparams, name='logout'), url(r'^(?P<user>\d+)/activate/$', Activate.as_view(), name='activate'), url(r'^(?P<user>\d+)/activation/new/$', NewActivationCode.as_view(), name='new_activation'), # Password reset url(r'^password/reset/$', 'django.contrib.auth.views.password_reset', resetparams1, name='password_reset'), url(r'^password/reset/done/$', 'django.contrib.auth.views.password_reset_done', name='password_reset_done'), url(r'^password/reset/(?P<uidb36>[0-9A-Za-z]{1,13})-(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', 'django.contrib.auth.views.password_reset_confirm', resetparams2, name='password_reset_confirm'), url(r'^password/reset/complete/$', 'django.contrib.auth.views.password_reset_complete', name='password_reset_complete'), url(r'^register/$', Registration.as_view(), name='register'),
ActionEndPoint, PurchaseTableEndPoint, CatagoryEndPoint, FilterItemsEndpoint, FilterPurchasesEndpoint, foo, ) from accounts.views import ( Registeration, Login, ) urlpatterns = [ url(r'^foo/bar$', foo), url(r'^foo/', admin.site.urls), # accounts url(r'^dollars/register/$', Registeration.as_view(), name="register"), url(r'^dollars/login/$', Login.as_view(), name="login"), url(r'^dollars/logout/', logout_then_login, name="logout"), # receipt url(r'^dollars/$', MainView.as_view(), name="main"), url(r'^dollars/api/items/$', ItemEndPoint.as_view(), name="api_items"), url(r'^dollars/api/items_edit/$', ItemManEndPoint.as_view(), name="api_items_edit"), url(r'^dollars/api/actions/$', ActionEndPoint.as_view(), name="api_actions"), url(r'^dollars/api/purchases/$', PurchaseTableEndPoint.as_view(), name="api_purchases"), url(r'^dollars/api/catagories/$', CatagoryEndPoint.as_view(), name="api_catagories"), url(r'^dollars/api/filter/items$', FilterItemsEndpoint.as_view(), name="foobarpop"), url(r'^dollars/api/filter/purchases$', FilterPurchasesEndpoint.as_view(), name="foobarpopup"), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
from django.conf.urls import patterns, include, url from django.contrib import admin from accounts.views import Index, Login, Signup, Contact, Logout urlpatterns = patterns( "", url(r'^$', Index.as_view(), name="home"), url(r'^login/$', Login.as_view(), name="login"), url(r'^signup/$', Signup.as_view(), name="signup"), url(r'^contact/$', Contact.as_view(), name="contact"), url(r'^logout/$', Logout.as_view(), name="logout"), )
from accounts.views import Login, Register, Logout, Dashboard, PasswordChange, PasswordChangeDone, EditAccount, PasswordReset, PasswordResetConfirm from django.conf.urls.static import static import django_js_reverse.views urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^jsreverse/$', django_js_reverse.views.urls_js, name='js_reverse'), url(r'^$', TemplateView.as_view(template_name='index.html'), name='home'), url(r'^contact$', TemplateView.as_view(template_name='contact.html'), name='contact'), url(r'^cursos$', Courses.as_view(), name='courses'), #url(r'^cursos/(?P<pk>\d+)/$', Details.as_view(), name='details'), url(r'^cursos/(?P<slug>[\w-]+)/$', Details.as_view(), name='details'), url(r'^entrar/$', Login.as_view(), name='login'), url(r'^cadastro/$', Register.as_view(), name='register'), url(r'^$', Logout.as_view(), name='logout'), url(r'^painel/$', Dashboard.as_view(), name='dashboard'), url(r'^editarsenha/$', PasswordChange.as_view(), name='passwordchange'), url(r'^editarsenha/concluido/$', PasswordChangeDone.as_view(), name='passwordchangedone'), url(r'^redefinirsenha/$', PasswordReset.as_view(), name='passwordreset'), url(r'^redefinirsenha/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', PasswordResetConfirm.as_view(), name='passwordresetconfirm'), url(r'^editarconta/$', EditAccount.as_view(), name='editaccount'), url(r'^cursos/(?P<slug>[\w-]+)/inscricao/$', Enrollment.as_view(), name='enrollment'),
from django.conf.urls import patterns, include, url from accounts.decorators import is_anonymous, is_not_activate from accounts.views import Login, Registration, BaseActivationView from django.views.generic.base import TemplateView from tastypie.api import Api from accounts.api.resources import * urlpatterns = patterns('accounts.views', url(r'^login/$', is_anonymous(Login.as_view()), name='login'), url(r'^logout/$', 'logout', name='logout'), url(r'^activate/(?P<activation_key>\w+)/$', is_anonymous(BaseActivationView.as_view()), name='registration_activate'), url(r'^activate/complete/$', TemplateView.as_view(template_name='accounts/activation_complete.html'), name='accounts_activation_complete'), url(r'^registration/$', is_anonymous(Registration.as_view()), name='registration'), url(r'^register/complete/$', TemplateView.as_view(template_name='accounts/registration_complete.html'), name='registration_complete'), url(r'^task tr/save/$', '_task_tr_account', name='task_tr'), ) v1_api = Api(api_name='v2') v1_api.register(UserResource()) v1_api.register(UserProfileResource()) urlpatterns += patterns('', (r'^api/', include(v1_api.urls)), )
from django.contrib import admin from django.urls import path, include from django.contrib.auth.views import LoginView, LogoutView from accounts.views import SignUpView, Login urlpatterns = [ path( 'accounts/', include([ path('sign-up', SignUpView.as_view(), name='sign_up'), path('login', Login.as_view(template_name='registration/login.html'), name='login'), path('logout', LogoutView.as_view( template_name='registration/logged_out.html'), name='logout'), # path('password_change/', include([ # path('', PasswordChangeView.as_view(), name='password_change'), # path('done', PasswordChangeDoneView.as_view(), name='password_change_done'), # ])), # # path('password_reset/', include([ # path('', PasswordChangeView.as_view(), name='password_reset'), # path('done', PasswordChangeDoneView.as_view(), name='password_reset_done'), # ])), # ])), ]
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 home.views import Home, Contact from accounts.views import Login, CheckUser, LogOut from django.conf import settings from django.conf.urls.static import static import notifications.urls urlpatterns = [ url(r'^$', view=Home.as_view(), name="HomePage"), url(r'^account/', include('accounts.urls')), url(r'^admin/', admin.site.urls), url(r'^login/$', view=Login.as_view(), name="Login"), url(r'^loggedin/$', view=CheckUser.as_view(), name="Loggedin"), url(r'^logout/$', view=LogOut.as_view(), name="Logout"), url(r'^messaging/', include('messaging.urls')), url(r'^listings/', include('listings.urls')), url(r'^appointment/', include('appointments.urls')), url('^notifications/', include(notifications.urls, namespace='notifications')), url(r'^contact/$', Contact.as_view(), name="Contact") ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)