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 import settings from django.conf.urls import include, url from django.conf.urls.static import static from django.contrib import admin from base.views import IndexView from registration.views import register_user, registration_form, register_success, login, auth_view urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$', IndexView.as_view(), name="index"), # user auth urls url(r'^accounts/login/$', login, name='login'), url(r'^accounts/auth/$', auth_view, name='auth_view'), url(r'^registration/$', registration_form, name='registration_form'), url(r'^signup/$', register_user, name='register_user'), url(r'^registration_success/$', register_success, name='register_success'), ] + static( settings.STATIC_URL, document_root=settings.STATIC_ROOT)
from django.contrib import admin from django.urls import path, include from django.conf.urls.static import static, settings from django.contrib.auth.views import LogoutView from users.views import LoginView, RegisterView from django.views.generic import TemplateView from base.views import IndexView, FormView, CompletedFormView from .settings import MEDIA_ROOT, MEDIA_URL urlpatterns = [ path('', LoginView.as_view(), name='login'), path('admin/', admin.site.urls), path('logout/', LogoutView.as_view(), name='logout'), path('register/', RegisterView.as_view(), name='register'), path('form/', FormView.as_view(), name='form'), path( 'completed_form/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9', CompletedFormView.as_view(), name='completed_form', ), path('dashboard/', IndexView.as_view(), name='dashboard'), ] + static(MEDIA_URL, document_root=MEDIA_ROOT)
ChoicePlaceView.as_view(), name='reservation_choice_place'), path('delete/<int:pk>', LeaveReservationView.as_view(), name='reservation_leave'), ], 'reservation') profile_patterns = ([ path('', DetailProfileView.as_view(), name='detail_profile'), path('update/', EditProfileView.as_view(), name='update_profile'), path('change_password/', ChangePasswordView.as_view(), name='change_password') ], 'profile') urlpatterns = [ path('admin/', admin.site.urls, name='admin'), path('login/', LoginView.as_view(), name='login'), path('', IndexView.as_view(), name='index'), path('view/<int:pk>', ReservationView.as_view(), name='view_reservation'), path('logout/', LogoutView.as_view(), name='logout'), path('signup/', SignUpView.as_view(), name='signup'), path('dashboard/', DashboardView.as_view(), name='dashboard'), path('reservation/', include(reservation_patterns)), path('profile/', include(profile_patterns)), ] if settings.DEBUG: urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
from django.urls import path from base.views import IndexView urlpatterns = [path('', IndexView.as_view())]
from django.utils.translation import ugettext_lazy as _ from django.contrib import admin from django.views.generic import TemplateView from base.views import IndexView, LoginRedirectView from django.conf import settings from django.conf.urls.static import static from wiki.urls import get_pattern as get_wiki_pattern from django_nyt.urls import get_pattern as get_notify_pattern from filebrowser.sites import site admin.autodiscover() # Add basic non-localized patterns urlpatterns = patterns('', url(r'^$', IndexView.as_view(), name='roots_index'), url(r'^login/$', LoginRedirectView.as_view(), name='roots_login'), url(r'^i18n/', include('django.conf.urls.i18n')), url(r'^protected/', include('downloads.urls')), ) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) urlpatterns += i18n_patterns('', # Examples: # url(r'^$', 'roots.views.home', name='home'), # url(r'^roots/', include('roots.foo.urls')), # Uncomment the admin/doc line below to enable admin documentation: # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), # Uncomment the next line to enable the admin: url(r'^$', IndexView.as_view(), name='roots_index'),
from django.conf.urls import url from base.views import IndexView urlpatterns = [ url(r'', IndexView.as_view(), name='index_view') ]
"""movie_app URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/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, include from django.contrib import admin from django.conf import settings from django.conf.urls.static import static from base.views import IndexView urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^api/', include('movies.urls', namespace='movies')), url(r'^$', IndexView.as_view()) ] if settings.DEBUG: urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
router = ExtendedSimpleRouter(trailing_slash=False) router.register(r'accounts', MyUserViewSet) router.register(r'tournoi', TournamentViewSet).register(r'posts', TPostViewSet, base_name="TPost", parents_query_lookups=['tournoi']) router.register(r'tournoi', TournamentViewSet).register(r'article', APostViewSet, base_name="APost", parents_query_lookups=['tournoi']) router.register(r'tournoi', TournamentViewSet).register( r'team', TeamsViewSet, base_name="team", parents_query_lookups=['tournoi']).register( r'match', MatchViewSet, base_name='Match', parents_query_lookups=['tournoi', 'phase']) router.register(r'posts', PostViewSet) urlpatterns = patterns('', url(r'^api/v1/', include(router.urls)), url(r'^api/ret/ipn', view=ipn), url(r'^api/v1/', include('base.urls')), url(r'^home$', HomeView.as_view()), url(r'^.*$', IndexView.as_view()))
from django.conf import settings from django.urls import include, path, re_path from django.contrib import admin from django.views.decorators.cache import cache_page from base.views import IndexView urlpatterns = [ path('admin/', admin.site.urls), path('api/v1/users/', include(('users.urls', 'users'), namespace='users')), path('api/v1/cards/', include(('cards.urls', 'cards'), namespace='cards')), path('api/v1/user_cards/', include(('user_cards.urls', 'user_cards'), namespace='user_cards')), path( 'api/v1/notifications/', include(('notifications.urls', 'notifications'), namespace='notifications')), # catch all others because of how history is handled by react router - cache this page because it will never change re_path(r'', cache_page(settings.PAGE_CACHE_SECONDS)(IndexView.as_view()), name='index'), ]
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 include, path from base.views import AboutView, IndexView from frontend.views import ReactIndexView urlpatterns = [ path('', IndexView.as_view(), name="index"), path('consultants/', include('employee.urls')), path('projects/', include('project.urls')), path('clients/', include('client.urls')), path('technologies/', include('technology.urls')), path('about/', AboutView.as_view(), name="about-us"), path('react/', ReactIndexView.as_view(), name="react-index"), path('admin/', include('admin_honeypot.urls', namespace='admin_honeypot')), path('alten_dk_admin/', admin.site.urls), path('api/', include('api.urls')), ] if settings.DEBUG: urlpatterns = urlpatterns + static( settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + static( settings.STATIC_URL, document_root=settings.STATIC_ROOT)
from django.conf.urls import patterns, include, url from django.contrib import admin from rest_framework_nested import routers from base.views import MyUserViewSet, IndexView, HomeView from tournoi.views import TournamentViewSet, TeamsViewSet, TPostViewSet, APostViewSet, ipn, ipn_test from post.views import PostViewSet from match.views import MatchViewSet from rest_framework_extensions.routers import ExtendedSimpleRouter router = ExtendedSimpleRouter(trailing_slash=False) router.register(r'accounts', MyUserViewSet) router.register(r'tournoi', TournamentViewSet).register(r'posts', TPostViewSet, base_name="TPost", parents_query_lookups=['tournoi']) router.register(r'tournoi', TournamentViewSet).register(r'article', APostViewSet, base_name="APost", parents_query_lookups=['tournoi']) router.register(r'tournoi', TournamentViewSet).register(r'team', TeamsViewSet, base_name="team", parents_query_lookups=['tournoi']).register(r'match', MatchViewSet, base_name='Match', parents_query_lookups=['tournoi', 'phase']) router.register(r'posts', PostViewSet) urlpatterns = patterns('', url(r'^api/v1/', include(router.urls)), url(r'^api/ret/ipn', view = ipn), url(r'^api/v1/', include('base.urls')), url(r'^home$', HomeView.as_view()), url(r'^.*$', IndexView.as_view()) )
urlpatterns = patterns('', url(r'^initialize/$', InitView.as_view(), name='init'), url(r'^tab/', include([ url(r'^$', TabView.as_view(), name='add'), url(r'^order/$', TabOrderView.as_view(), name='order'), url(r'^(?P<reference>\w+)/$', TabView.as_view(), name='edit'), url(r'^(?P<reference>\w+)/delete/$', TabView.as_view(remove=True), name='delete'), ],namespace='tab')), url(r'^link/', include([ url(r'^$', LinkView.as_view(), name='add'), url(r'^search/$', LinkSearchView.as_view(), name='search'), #url(r'^order/$', LinkOrderView.as_view(), name='order'), url(r'^(?P<reference>\w+)/$', LinkView.as_view(), name='edit'), url(r'^(?P<reference>\w+)/delete/$', LinkView.as_view(remove=True), name='delete'), ],namespace='link')), # let the front-end deal with these urls url(r'^tabs/(?P<tab>\w+)/$', IndexView.as_view(), name='tabs'), url(r'^tabs/add/$', IndexView.as_view(), name='tabs_index_add'), url(r'^tabs/order/$', IndexView.as_view(), name='tabs_index_order'), url(r'^tabs/manage/(?P<id>\w+)/$', IndexView.as_view(), name='tabs_index_manage'), url(r'^tabs/edit/(?P<id>\w+)/$', IndexView.as_view(), name='tabs_index_edit'), url(r'^bookmarks/(?P<bookmark>\w+)/$', IndexView.as_view(), name='bookmarks'), url(r'^add/$', IndexView.as_view(), name='bookmarks_index_add'), #url(r'^bookmarks/order/$', IndexView.as_view(), name='bookmarks_index_order'), url(r'^edit/(?P<id>\w+)/$', IndexView.as_view(), name='bookmarks_index_edit'), url(r'^search/$', IndexView.as_view(), name='bookmarks_index_search'), )
from django.urls import path from base.views import IndexView urlpatterns = [ path('', IndexView.as_view()), ]