示例#1
0
"""drf_api 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, include
from rest_framework.authtoken.views import obtain_auth_token
from core.views import PostView, PostCreateView, PostListCreateView, DestroyAPIView

urlpatterns = [
    path('api-auth/', include('rest_framework.urls')),
    path('admin/', admin.site.urls),
    path('', PostView.as_view(), name='test'),
    path('create/', PostCreateView.as_view(), name='create'),
    path('list-create/', PostListCreateView.as_view(), name='list-create'),
    path('delete/', DestroyAPIView.as_view(), name='delete'),
    path('api/token/', obtain_auth_token, name='obtain-token')
]
示例#2
0
"""carservice 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, include
from core.views import PostView, PostCreateView, PostListCreateView
from rest_framework.authtoken.views import obtain_auth_token

urlpatterns = [
    path('api-auth/', include('rest_framework.urls')),
    path('admin/', admin.site.urls),
    path('', PostView.as_view(), name='test'),
    path('create/', PostCreateView.as_view(), name='create'),
    path('posts/', PostListCreateView.as_view(), name='posts'),
    path('api/token/', obtain_auth_token, name='obtain-token'),
    path('rest-auth/', include('rest_auth.urls')),
    path('articles/', include('core.urls'))
]
示例#3
0
from django.contrib import admin
from django.urls import path, include
from django.urls import path
from rest_framework.authtoken.views import obtain_auth_token
from core.views import PostView, PostCreateView, TestView, PostListCreateView, loginPage, registerPage, home, Postregister
from django.conf.urls import url
from Tools.scripts import serve
from drf_api import settings

urlpatterns = [
    path('rest-auth/', include('rest_auth.urls')),
    path('api-auth/', include('rest_framework.urls')),
    path('admin/', admin.site.urls),
    path('postview/', PostView.as_view(), name='test'),
    path('postreg/', Postregister.as_view(), name='reg'),
    path('create/', PostCreateView.as_view(), name='create'),
    path('test/', TestView.as_view(), name='create'),
    path('list-create/', PostCreateView.as_view(), name='list-create'),
    path('hemanth/', PostListCreateView.as_view(), name='list'),
    path('api/token/', obtain_auth_token, name='obtain-token'),
    path('login/', loginPage, name='login'),
    path('', registerPage),
    path('home/', home),
    url(r'^media/(?P<path>.*)$', serve,
        {'document_root': settings.MEDIA_ROOT}),
    url(r'^static/(?P<path>.*)$', serve,
        {'document_root': settings.STATIC_ROOT}),
]
示例#4
0
"""drf_api URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    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 core.views import PostCreateView, PostListCreateView, PostView, TestView
from django.contrib import admin
from django.urls import include, path
from rest_framework.authtoken.views import obtain_auth_token

urlpatterns = [
    path("api-auth/", include("rest_framework.urls")),
    path("rest-auth/", include("rest_auth.urls")),
    path("admin/", admin.site.urls),
    path("", PostView.as_view(), name="test"),
    path("create/", PostCreateView.as_view(), name="create"),
    path("list-create/", PostListCreateView.as_view(), name="list-create"),
    path("api/token/", obtain_auth_token, name="obtain-token"),
]
"""drf_api URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    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 core.views import PostView, PostCreateView, PostListCreateView
from django.contrib import admin
from django.urls import path, include
from rest_framework.authtoken.views import obtain_auth_token

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', PostView.as_view(), name = 'test'),
    path('api-auth/', include('rest_framework.urls')),
    path('api/token/', obtain_auth_token, name = 'obtain-token'),
    path('rest-auth/', include('rest_auth.urls')),
    path('create/', PostCreateView.as_view(), name = 'create'),
    path('createUsingGenerics/', PostListCreateView.as_view(), name = 'createGenerics'),
]