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 updates.views import ( json_response_view, http_response_view, JsonCBV, JsonResponseMixinView, SerializedDetailView, SerializedListView ) urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^json/$', JsonCBV.as_view()), url(r'^jrm/$', JsonResponseMixinView.as_view()), url(r'^http/$', http_response_view), url(r'^json/serialized/detail/$', SerializedDetailView.as_view()), url(r'^json/serialized/list/$', SerializedListView.as_view()), ]
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 updates.views import ( update_model_detail_view, JsonCBV, JsonCBV2, SerializedListView, SerializedDetailView ) urlpatterns = [ path('admin/', admin.site.urls), path('json/cbv', JsonCBV.as_view()), path('json/cbv2', JsonCBV2.as_view()), path('json/example', update_model_detail_view), path('json/serializer/list', SerializedListView.as_view()), path('json/serializer/detail', SerializedDetailView.as_view()), ]
from django.conf.urls import url, include from django.contrib import admin from django.conf.urls.static import static from django.conf import settings from rest_framework_jwt.views import obtain_jwt_token, refresh_jwt_token from updates.views import (json_example, JsonExampleCBV, JsonExampleCBV2, SerializedListView, SerializedDetailView) urlpatterns = [ url(r'^api/status/', include('status.api.urls')), url(r'^api/auth/', include('accounts.api.urls')), url(r'^$', json_example), url(r'^one', JsonExampleCBV.as_view()), url(r'^two', JsonExampleCBV2.as_view()), url(r'^serailized/list', SerializedListView.as_view()), url(r'^serailized/detail', SerializedDetailView.as_view()), url(r'^admin/', admin.site.urls), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
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, include from django.contrib import admin from updates.views import json_example_view, JsonCBV, JsonCBV2, SerializedDetailView, SerializedListView urlpatterns = [ url(r'^api/updates/', include('updates.api.urls')), url(r'^admin/', admin.site.urls), url(r'^json/example/$', json_example_view), url(r'^json/cbv/$', JsonCBV.as_view()), url(r'^json/cbv2/$', JsonCBV2.as_view()), url(r'^json/srv/$', SerializedDetailView.as_view()), url(r'^json/srlv/$', SerializedListView.as_view()) ]
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, include from updates.views import (json_example_view, JSONCBV, JSONCBV2, SerializedDetailView, SerializedListView) urlpatterns = [ path('admin/', admin.site.urls), path('json/example/', json_example_view), path('json/cbv/', JSONCBV.as_view()), path('json/cbv2/', JSONCBV2.as_view()), path('json/sdv/', SerializedDetailView.as_view()), path('json/slv/', SerializedListView.as_view()), path('api/updates/', include('updates.api.urls')), path('api/status/', include('status.api.urls', namespace="api-status")), path('api/auth/', include('accounts.api.urls', namespace="api-auth")), # path('api/user/', include('accounts.api.urls_user', namespace="api-user")), path('api/user/', include('accounts.api.user.urls', namespace="api-user")), ]
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 # from rest_framework_jwt.views import obtain_jwt_token, refresh_jwt_token from updates.views import ( json_dummy_view, JsonDummyCBV, JsonDummyCBVWithMixin, SerializedListView, SerializedDetailView ) urlpatterns = [ path('admin/', admin.site.urls), path('dummy/', json_dummy_view), path('dummy/cbv/', JsonDummyCBV.as_view()), path('dummy/mixin/', JsonDummyCBVWithMixin.as_view()), path('dummy/serializer/detail/', SerializedDetailView.as_view()), path('dummy/serializer/list/', SerializedListView.as_view()), # if namespace is specified, we must mention app_name as well path('api/status/', include('status.api.urls', namespace='api-status')), # path('api/auth/jwt/', obtain_jwt_token), # path('api/auth/jwt/refresh/', refresh_jwt_token), path('api/auth/', include('accounts.api.urls', namespace='api-auth')), path('api/user/', include('accounts.api.user.urls', namespace='api-user')), ]
"""cfeapi URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: 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 updates.views import json_example_view, JsonCBV, JsonCBV2, SerializedListView, SerializedDetailView from updates import views urlpatterns = [ path('admin/', admin.site.urls), path('json/cbv/', JsonCBV.as_view()), path('json/cbv2/', JsonCBV2.as_view()), path('json/serialized/list/', SerializedListView.as_view()), path('', SerializedDetailView.as_view()), path('json/example/', json_example_view, name=''), ]
from django.conf.urls import url from django.urls import include from updates.views import ( json_example_view, JsonCBV, JsonCBV2, SerializedListView, SerializedDetailView, ) urlpatterns = [ url(r'^$', json_example_view), url(r'example/', json_example_view), url(r'cbv/', JsonCBV.as_view()), url(r'cbv2/', JsonCBV2.as_view()), url(r'serialize/', SerializedListView.as_view()), url(r'serialize-detail/', SerializedDetailView.as_view()) ]