from django.conf.urls import url, include from django.contrib import admin from .views import home, redirect_somewhere from dashboard.views import DashboardTemplateView, MyView, BookDetail urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$', home, name='home'), url(r'^redirect/$', redirect_somewhere, name='redirect'), url(r'^blog/', include('blog.urls', namespace='blog')), url(r'dashboard/', DashboardTemplateView.as_view(), name='dashboard'), url(r'myview/', MyView.as_view(), name='myview'), url(r'book/', BookDetail.as_view(), name='book'), ]
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 import settings from django.conf.urls.static import static from django.contrib import admin from django.urls import path, include from dashboard.views import DashboardTemplateView, SocialLoginTemplateView, PrivacyPolicyTemplateView urlpatterns = [ path('data-collector/', SocialLoginTemplateView.as_view(), name='social'), path('data-collector/privacypolicy/', PrivacyPolicyTemplateView.as_view(), name='privacypolicy'), path('data-collector/admin/', admin.site.urls), path('data-collector/accounts/login/', SocialLoginTemplateView.as_view(), name='signup'), path('data-collector/accounts/', include('allauth.urls')), path('data-collector/contributions/', include('contribution.urls')), path('data-collector/dashboard/', DashboardTemplateView.as_view(), name='dashboard'), path('data-collector/api/v1/', include('api.urls')), path('data-collector/users/', include('users.urls')), path('data-collector/users/', include('django.contrib.auth.urls')), path('data-collector/otp/', include('otp.urls')), ] + static( settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
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 django.conf.urls import url, include from rest_framework_jwt.views import obtain_jwt_token, refresh_jwt_token from django.conf.urls.static import static from django.conf import settings from dashboard.views import DashboardTemplateView urlpatterns = [ path('admin/', admin.site.urls), path('', DashboardTemplateView.as_view(), name='dashboard'), path('accounts/', include('django.contrib.auth.urls')), url(r'^login/', obtain_jwt_token), url(r'^refreshtoken/', refresh_jwt_token), url(r'^users/', include('users.urls')), url('api/', include('api.urls')) ] urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
from django.conf import settings from django.conf.urls.static import static from django.conf.urls import include, url from django.contrib import admin from django.views.generic.base import TemplateView from dashboard.views import DashboardTemplateView, MyView, BookDetail urlpatterns = [ # Examples: url(r'^$', 'newsletter.views.home', name='home'), url(r'^contact/$', 'newsletter.views.contact', name='contact'), # url(r'^about/$', TemplateView.as_view(template_name='about.html'), name='about'), url(r'^book/(?P<slug>[-\w]+)$', BookDetail.as_view(), name='book_detail'), url(r'^someview/$', MyView.as_view(template_name='about.html'), name='about'), url(r'^about/$', DashboardTemplateView.as_view(), name='about'), # url(r'^blog/', include('blog.urls')), url(r'^admin/', include(admin.site.urls)), url(r'^accounts/', include('registration.backends.default.urls')), ] if settings.DEBUG: urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
from django.conf.urls import url from . import views from dashboard.views import ( DashboardTemplateView, MyView, ) urlpatterns = [ url(r'^$', views.home, name='home'), url(r'^contact/$', views.contact, name='contact'), url(r'^someview/$', MyView.as_view(), name='someview'), url(r'^about/$', DashboardTemplateView.as_view(), name='about'), ]
from django.conf.urls.static import static from django.contrib import admin from django.views.generic.base import TemplateView from dashboard.views import DashboardTemplateView, MyView,\ BookDetail, BookListView, BookCreateView,\ BookUpdateView, BookDeleteView urlpatterns = [ # Examples: url(r'^$', 'newsletter.views.home', name='home'), url(r'^contact/$', 'newsletter.views.contact', name='contact'), #url(r'^about/$', 'cbv.views.about', name='about'), url(r'^book/create/$', BookCreateView.as_view(), name='book_create'), url(r'^book/$', BookListView.as_view(), name='book_list'), url(r'^book/(?P<slug>[-\w]+)/$', BookDetail.as_view(), name='book_detail'), url(r'^book/(?P<slug>[-\w]+)/delete/$', BookDeleteView.as_view(), name='book_delete'), url(r'^book/(?P<slug>[-\w]+)/update/$', BookUpdateView.as_view(), name='book_update'), url(r'^someview/$', MyView.as_view(template_name='about.html'), name='someview'), url(r'^about/$', DashboardTemplateView.as_view(), name='about'), url(r'^team/$', DashboardTemplateView.as_view(template_name='team.html'), name='team'), # url(r'^blog/', include('blog.urls')), url(r'^admin/', include(admin.site.urls)), url(r'^accounts/', include('registration.backends.default.urls')), ] if settings.DEBUG: urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
"""iebc 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 dashboard.views import DashboardTemplateView, SenetorsListTemplateView, GovernorListTemplateView, WomensRepListTemplateView urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$', DashboardTemplateView.as_view(), name='home'), url(r'^governors/$', GovernorListTemplateView.as_view(), name='governors'), url(r'^senetors/$', SenetorsListTemplateView.as_view(), name='senetors'), url(r'^women-rep/$', WomensRepListTemplateView.as_view(), name='women-rep') ]
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 dashboard.views import DashboardTemplateView, MyView, BookDetail, BookListView, BookCreateView, BookUpdateView, \ BookDeleteView from django.contrib import admin from django.urls import path urlpatterns = [ path('someview/', MyView.as_view(), name='home'), path('about/', DashboardTemplateView.as_view(), name='about'), path('book/create/', BookCreateView.as_view(), name='book_create'), path('book/<slug:slug>/', BookDetail.as_view(), name='book_detail'), path('book/<slug:slug>/update/', BookUpdateView.as_view(), name='book_update'), path('book/<slug:slug>/delete/', BookDeleteView.as_view(), name='book_delete'), path('books/', BookListView.as_view(), name='book_list'), path('admin/', admin.site.urls), ]
urlpatterns = [ # Examples: url(r'^$', 'newsletter.views.home', name='home'), url(r'^contact/$', 'newsletter.views.contact', name='contact'), #url(r'^about/$', 'cbv.views.about', name='about'), url(r'^book/create/$', BookCreateView.as_view(), name='book_create'), url(r'^book/$', BookListView.as_view(), name='book_list'), url(r'^book/(?P<slug>[-\w]+)/$', BookDetail.as_view(), name='book_detail'), url(r'^book/(?P<slug>[-\w]+)/delete/$', BookDeleteView.as_view(), name='book_delete'), url(r'^book/(?P<slug>[-\w]+)/update/$', BookUpdateView.as_view(), name='book_update'), url(r'^someview/$', MyView.as_view(template_name='about.html'), name='someview'), url(r'^about/$', DashboardTemplateView.as_view(), name='about'), url(r'^team/$', DashboardTemplateView.as_view(template_name='team.html'), name='team'), # url(r'^blog/', include('blog.urls')), url(r'^admin/', include(admin.site.urls)), url(r'^accounts/', include('registration.backends.default.urls')), ] if settings.DEBUG: urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)