示例#1
0
The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.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 include, path, re_path
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView

admin.site.site_header = 'PackOne Console' # default: "Django Administration"
admin.site.index_title = 'Dashboard' # default: "Site administration"
admin.site.site_title = 'PackOne Console' # default: "Django site admin"
admin.site.site_url = None

urlpatterns = [
    re_path(r'^', admin.site.urls),
    path('api/user/', include('user.urls')),
    path('api/clouds/', include('clouds.urls')),
    path('api/engines/', include('engines.urls')),
    # path('api/data/', include('data.urls')),
    re_path(r'^api/token/$', TokenObtainPairView.as_view(), name='token_obtain_pair'),
    re_path(r'^api/token/refresh/$', TokenRefreshView.as_view(), name='token_refresh'),
]
示例#2
0
文件: urls.py 项目: ucifer7964/newreg
"""newreg 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_simplejwt.views import (TokenObtainPairView,
                                            TokenRefreshView, TokenVerifyView)
urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('testapp.urls')),
    path('get_token/', TokenObtainPairView.as_view(),
         name='token_obtain_pair'),
    path('refresh_token/', TokenRefreshView.as_view(), name='token_refresh'),
    path('verify_token/', TokenVerifyView.as_view(), name='token_verify'),
]
示例#3
0
router.register(r'orders', OrderInfoViewSet, basename='orders')
router.register(r'banners', BannerGoodsViewSet, basename='banners')
# 首页商品系列数据
router.register(r'indexgoods', IndexCategoryViewSet, basename='indexgoods')

urlpatterns = [
    path('admin/', admin.site.urls),
    url(r'^xadmin/', xadmin.site.urls),
    url(r'media/(?P<path>.*)$', serve, {'document_root': MEDIA_ROOT}),
    # coreapi 文档功能
    url(r'docs/', include_docs_urls(title='学习文档')),
    # 调试 api 的登录 url
    url(r'^api-auth/', include('rest_framework.urls')),
    # 使用 router 来配置 各模块 url
    url(r'^', include(router.urls)),

    # JWT 认证
    # 由于这里的登录默认是使用 username 来登录的,如果需要手机号也能登录需要自定义
    path('login/', TokenObtainPairView.as_view(), name='login'),
    path('login/refresh/', TokenRefreshView.as_view(), name='login_refresh'),

    # Alipay 回调和return_url 接口
    url(r'^alipay/return/', AliPayView.as_view(), name='alipay'),
    url(r'^index/', TemplateView.as_view(template_name='index.html'))

    # DRF token 认证
    # url(r'^api-token-auth/', views.obtain_auth_token),
    # 商品列表页
    # url(r'goods/$', GoodsListView2.as_view(), name='goods-list'),
]
示例#4
0
from drf_yasg import openapi

from .views import index

# App's Basic urls
urlpatterns = [
    path("admin/", admin.site.urls),
    path("", index, name="home"),
    # Catch many another routing...
    re_path(r"^.*", TemplateView.as_view(template_name="index.html")),
]

# Adding 01 : Restful Frameworks API urls
urlpatterns += [
    path("api-auth/", include("rest_framework.urls")),
    path("api/token/", TokenObtainPairView.as_view(),
         name="token_obtain_pair"),
    path("api/token/refresh/",
         TokenRefreshView.as_view(),
         name="token_refresh"),
    path("api/accounts/", include("accounts.urls")),
    path("api/realtors/", include("realtors.urls")),
    path("api/listings/", include("listings.urls")),
    path("api/contacts/", include("contacts.urls")),
]

# Adding the Django Rest Framework's Documents
schema_view = get_schema_view(
    openapi.Info(
        title="Blog API",
        default_version="v1",
示例#5
0
router.register(r'posts', views.PostViewSet)
router.register(r'case-studies', views.CaseStudyViewSet)
router.register(r'highlighted-case-studies', views.HighlightedCaseStudyViewSet)

urlpatterns = [
    re_path(r'^admin-cool/', admin.site.urls),
    re_path(r'^django-health-check/$',
            BlogViews.HealthCheckView.as_view(),
            name='django-health-check'),
    re_path(r'^fail-test/$', BlogViews.FailView.as_view(), name='fail-test'),
    re_path(r'^report', BlogViews.EmailView.as_view(), name='report'),
    re_path(r'^recaptcha/$',
            BlogViews.ContactMeView.as_view(),
            name='recaptcha'),

    # re_path(r'^ckeditor/', include('ckeditor_uploader.urls')),
    re_path(r'^api/uploads/', views.FileUploadView.as_view()),
    re_path(
        r'^api-auth/',
        include(
            'rest_framework.urls',
            namespace='rest_framework')),  # for the browsable API login URLs
    re_path(r'^api/token-auth/',
            TokenObtainPairView.as_view(),
            name='token_obtain_pair'),  # for the browsable API login URLs
    re_path(r'^api/token-refresh/',
            TokenRefreshView.as_view(),
            name='token_refresh'),  # for the browsable API login URLs
    re_path(r'^api/', include(router.urls)),
    re_path(r'^.*$', views.APIIndexView.as_view()),
]
from django.conf.urls import url, include
from rest_framework import routers
from rest_framework.schemas import get_schema_view
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView
from veterinary import views

router = routers.DefaultRouter()
router.register(r'veterinary', views.VeterinaryViewSet)
router.register(r'animals', views.AnimalViewSet)
router.register(r'donations', views.DonationViewSet)

schema_view = get_schema_view(title='Ong API')

urlpatterns = [
    url(r'^', include(router.urls)),
    url(r'^api-auth/', include('rest_framework.urls')),
    url(r'^api/token$', TokenObtainPairView.as_view(),
        name='token_obtain_pair'),
    url(r'^api/token/refresh$', TokenRefreshView.as_view(),
        name='toke_refresh'),
    url(r'^schema/$', schema_view),
]
示例#7
0
from django.urls import path
from rest_framework_simplejwt.views import (
    TokenObtainPairView,
    TokenRefreshView,
)
from rest_framework.routers import DefaultRouter

from . import views

router = DefaultRouter()
router.register(r'files', views.FilesViewSet, basename='files')
router.register(r'places', views.PlacesViewSet, basename='places')

urlpatterns = [
    path('signup', views.sign_up_user),
    path('profile', views.profile),
    path('app_init', views.app_init_data),
    path('token', TokenObtainPairView.as_view(), name='token_obtain_pair'),
    path('token/refresh', TokenRefreshView.as_view(), name='token_refresh'),
] + router.urls
示例#8
0
from django.urls import path

from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView

urlpatterns = [
    path('token/obtain', TokenObtainPairView.as_view(), name="obtaintoken"),
    path('token/refresh', TokenRefreshView.as_view(), name="refreshtoken")
]
示例#9
0
from django.urls import path, include
from . import views
from rest_framework.routers import DefaultRouter
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView, TokenVerifyView

# Creating Router Object
router = DefaultRouter()

# Registering EmployeeViewSet with Router
router.register('employee', views.EmployeeModelViewSet, basename='employee')
urlpatterns = [
    path('', include(router.urls)),
    path('gettoken/', TokenObtainPairView.as_view(), name="token_obtain-pair"),
    path('refreshtoken/', TokenRefreshView.as_view(), name="token_refresh"),
    path('verifytoken/', TokenVerifyView.as_view(), name="token_verify"),
]

# Note To generate Token use this command
# http POST http://127.0.0.1:8000/api/gettoken/ username="******" password="******"

# OUTPUT will be:
# HTTP/1.1 200 OK
# Allow: POST, OPTIONS
# Content-Length: 438
# Content-Type: application/json
# Date: Sat, 09 Jan 2021 08:18:47 GMT
# Server: WSGIServer/0.2 CPython/3.8.3
# Vary: Accept
# X-Frame-Options: SAMEORIGIN
#
# {
示例#10
0
文件: urls.py 项目: easy-rpg/SheetAPI
from django.urls import path, include
from rest_framework import routers
from rest_framework_swagger.views import get_swagger_view
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView
from .views import UserViewSet, CreateUserView
from campanha.views import CampanhaViewSet, ArcoViewSet
from core.views import ClasseViewset
from personagem.views import PersonagemViewSet, PersonagemClasseViewSet, PersonagemModeloViewSet, \
    PersonagemAtributoViewSet

router = routers.DefaultRouter()
router.register('user', UserViewSet)
router.register('campanha', CampanhaViewSet)
router.register('arco', ArcoViewSet)
router.register('classe', ClasseViewset)
router.register('personagem', PersonagemViewSet)
router.register('personagem_classe', PersonagemClasseViewSet)
router.register('personagem_modelo', PersonagemModeloViewSet)
router.register('personagem_atributo', PersonagemAtributoViewSet)

schema_view = get_swagger_view(title='RPG Sheet API')

urlpatterns = [
    path('', schema_view),
    path('', include(router.urls)),
    path('create_user/', CreateUserView.as_view()),
    path('auth/', TokenObtainPairView.as_view()),
    path('auth/refresh/', TokenRefreshView.as_view()),
    path('ui-auth/', include('rest_framework.urls'))
]
示例#11
0
    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 rest_framework_simplejwt.views import TokenObtainPairView, TokenVerifyView

from deepleasy.views import ModelBuilderSupervised, ModelOptions, ModelProgress, ModelHistory, ModelGetter, \
    ModelBuilderUnsupervised, UserStats, ModelPredict

urlpatterns = [
    path('admin/', admin.site.urls),

    path('api/model/options/', ModelOptions.as_view()),
    path('api/model/builder/supervised/', ModelBuilderSupervised.as_view()),
    path('api/model/builder/unsupervised/', ModelBuilderUnsupervised.as_view()),

    path('api/model/progress/', ModelProgress.as_view()),
    path('api/model/history/', ModelHistory.as_view()),
    path('api/model/predict/', ModelPredict.as_view()),
    path('api/model/', ModelGetter.as_view()),

    path('api/user/stats/', UserStats.as_view()),

    path('api/auth/token/', TokenObtainPairView.as_view()),
    path('api/auth/verify/', TokenVerifyView.as_view()),
    # path('api/auth/refresh/', TokenRefreshView.as_view()),
]
示例#12
0
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_simplejwt.views import (
    TokenObtainPairView,
    TokenRefreshView,
)

from short_links.views import FollowLinkView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('api/v1/', include('short_links.urls')),
    path('<short_url>/', FollowLinkView.as_view()),
    path('api/token/', TokenObtainPairView.as_view(), name='get_token'),
    path('api/token/refresh/',
         TokenRefreshView.as_view(),
         name='refresh_token'),
]
示例#13
0
    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 include, path
from rest_framework_swagger.views import get_swagger_view
from rest_framework_simplejwt.views import (
    TokenObtainPairView,
    TokenRefreshView,
    TokenVerifyView
)

schema_view = get_swagger_view(title='Auth API')


api_urlpatterns = [
    path('accounts/', include('rest_registration.api.urls')),
]

urlpatterns = [
    path('admin/', admin.site.urls),
    path('api/ky/', include(api_urlpatterns)),
    path(r'api/docs/', schema_view),
    path('api/ky/accounts/token/', TokenObtainPairView.as_view(), name='token_obtain_pair'),
    path('api/ky/accounts/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
    path('api/ky/accounts/token/verify/', TokenVerifyView.as_view(), name='token_verify'),
    path('api/ky/server/', include('contact.urls')),
]
示例#14
0
from api.views import BoardViewSet, PostViewSet, CommentViewSet, UserViewSet
from django.conf.urls import url, include
from rest_framework.routers import DefaultRouter
from rest_framework_simplejwt.views import TokenObtainPairView, TokenVerifyView, TokenRefreshView

router = DefaultRouter()
router.register(r'comments', CommentViewSet)
router.register(r'posts', PostViewSet)
router.register(r'boards', BoardViewSet)
router.register(r'users', UserViewSet)

urlpatterns = [
    url(r'^', include(router.urls)),
    url(r'^token/$', TokenObtainPairView.as_view()),
    url(r'^token/verify/$', TokenVerifyView.as_view()),
    url(r'^token/refresh/$', TokenRefreshView.as_view()),
]
示例#15
0
from django.urls import path
from .views import *
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView


urlpatterns=[
  path('pacientes', PacientesController.as_view()),
  path('pacientes/<str:dni>', PacienteController.as_view()),
  path('pacienteHclinicas/<str:dni>',PacienteHClinicasController.as_view()),
  path('tratamientos',TratamientosController.as_view()),
  path('tratamientos/<int:id>',TratamientoController.as_view()),
  path('hclinicas', HClinicasController.as_view()),
  path('hclinicas/<int:id>',HClinicaController.as_view()),
  path('pendientePago', HClinicasSinPagarController.as_view()),
  path('citas', CitasController.as_view()),
  path('citas/<int:id>', CitaController.as_view()),
  path('registro',RegistrarPersonalController.as_view()),
  path('login', TokenObtainPairView.as_view()),
  path('refresh-token',TokenRefreshView.as_view()),
  path('login-custom', CustomPayloadController.as_view()),
] 
示例#16
0
# from currency_exchange import settings WRONG!
from django.conf import settings

API_PREFIX = 'api/v1'

urlpatterns = [
    path('', TemplateView.as_view(template_name='index.html'), name='index'),
    path('admin/', admin.site.urls),
    path('auth/', include('django.contrib.auth.urls')),

    path('account/', include('account.urls')),
    path('currency/', include('currency.urls')),

    # API
    path(f'{API_PREFIX}/currency/', include('currency.api.urls')),
    path(f'{API_PREFIX}/token/', TokenObtainPairView.as_view(), name='token_obtain_pair'),
    path(f'{API_PREFIX}/token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
]

# SWAGGER
from rest_framework_swagger.views import get_swagger_view
schema_view = get_swagger_view(title='DOCS')

urlpatterns.append(path(f'{API_PREFIX}/docs/', schema_view))

if settings.DEBUG:
    urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

# JWT eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNTg2NDU5MzQxLCJqdGkiOiIxZTJjNjAxMjBmNjc0MmFmYmIwNmFkYjBkYTJkODc1OCIsInVzZXJfaWQiOjh9.PScH_ZKujjlF8zJyGWGVC7_DjxVscm843Aog2YW9838
# Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNTg2NDU5MzQxLCJqdGkiOiIxZTJjNjAxMjBmNjc0MmFmYmIwNmFkYjBkYTJkODc1OCIsInVzZXJfaWQiOjh9.PScH_ZKujjlF8zJyGWGVC7_DjxVscm843Aog2YW9838
示例#17
0
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path, include
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('api-auth/', include('rest_framework.urls',
                              namespace='rest_framework')),
    path('auth/token', TokenObtainPairView.as_view(),
         name='token_obtain_pair'),
    path('auth/token/refresh',
         TokenRefreshView.as_view(),
         name='token_refresh'),
    path('auth/', include('users.urls', namespace='users')),
    path('api/', include('api.urls', namespace='api')),
] + 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/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 django.contrib import admin
from django.urls import path, include
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView

from users.urls import urlpatterns as users_urlpatterns
from questionnaire.urls import urlpatterns as questionnaire_urlpatterns

urlpatterns = [
    path('admin/', admin.site.urls),
    path('api/', include(users_urlpatterns)),
    path('api/', include(questionnaire_urlpatterns)),
    path('api/token/', TokenObtainPairView.as_view(), name='token-obtain'),
    path('api/token/refresh/',
         TokenRefreshView.as_view(),
         name='token-refresh')
]
示例#19
0
文件: urls.py 项目: kdechant/eamon
from django.conf.urls import include, url
from django.contrib import admin

from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url('api/token/$', TokenObtainPairView.as_view(),
        name='token_obtain_pair'),
    url('api/token/refresh/', TokenRefreshView.as_view(),
        name='token_refresh'),
    url(r'^', include('adventure.urls')),
    url(r'^', include('designer.urls')),
]
示例#20
0
from django.urls import path

from rest_framework_simplejwt.views import (
    TokenObtainPairView,
    TokenRefreshView,
)
from .views import (
    PostListView,
    PostDetailView,
    CommentCreateView,
    RatingCreateView,
    UserCreateView,
    UserDetailView,
)

urlpatterns = [
    path("news/", PostListView.as_view()),
    path("news/<int:pk>/", PostDetailView.as_view()),
    path("news/<int:pk>/create_comment/", CommentCreateView.as_view()),
    path("news/<int:pk>/create_rating/", RatingCreateView.as_view()),
    path("user/", UserCreateView.as_view()),
    path("user/<int:pk>/", UserDetailView.as_view()),
    path('token/', TokenObtainPairView.as_view()),
    path('token/refresh/', TokenRefreshView.as_view()),
]
示例#21
0
"""
from django.contrib import admin
from lxWeb.settings.common import MEDIA_ROOT
from django.urls import path, re_path
from django.conf.urls import url, include
from django.views.static import serve
from rest_framework.routers import DefaultRouter
from rest_framework.documentation import include_docs_urls
from rest_framework.routers import DefaultRouter
from rest_framework.authtoken import views
from rest_framework_simplejwt.views import (TokenObtainPairView, TokenRefreshView,)
from userapp.views import UserViewSet,UserProfileViewset

router = DefaultRouter()
router.register(r'admins', UserViewSet)
router.register(r'profile', UserProfileViewset)
urlpatterns = [
    url(r'^', include(router.urls)), 
    url(r'docs/', include_docs_urls(title="APP Inventor案例库")),      # 自动生成的API说明文档
    url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
    # url(r'^login/', obtain_jwt_token),
    url(r'^api/token/obtain/$', TokenObtainPairView.as_view(), name='token_obtain_pair'),	# 需要添加的内容
    url(r'^api/token/refresh/$', TokenRefreshView.as_view(), name='token_refresh'),	# 需要添加的内容

]

urlpatterns.extend([
    url(r'^media/(?P<path>.*)$', serve, {"document_root": MEDIA_ROOT}),     # path 将作为第二参数传到server进行处理
])

示例#22
0
    UserDetailsAPI,
    PermissionsListAPI,
    PermissionDetailAPI,
    ChangeEmailView,
    ResetPasswordForm,
)

from rest_framework_simplejwt.views import (
    TokenObtainPairView,
    TokenRefreshView,
)

urlpatterns = [
    # Authentication Urls
    path('auth/signup', RegisterAPI.as_view(), name="signup"),
    path('auth/login', TokenObtainPairView.as_view(),
         name='token_obtain_pair'),
    path('auth/token/refresh/',
         TokenRefreshView.as_view(),
         name='token_refresh'),

    # Profile Urls
    path('account/update', UpdateUserAPI.as_view(), name="update_account"),
    path('account/password-reset',
         include('django_rest_passwordreset.urls',
                 namespace='password_reset')),
    path('account/password-reset-form',
         ResetPasswordForm.as_view(),
         name='password_reset_form'),
    path('account/change-email',
         ChangeEmailView.as_view(),
示例#23
0
from django.urls import path, include
from django.contrib import admin
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView, TokenVerifyView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('accounts/', include('allauth.urls')),
    path('rest-auth/', include('rest_auth.urls')),
    path('rest-auth/registration/', include('rest_auth.registration.urls')),
    path('api-jwt-auth/', TokenObtainPairView.as_view()),      # JWT 토큰 획득
    path('api-jwt-auth/refresh/', TokenRefreshView.as_view()), # JWT 토큰 갱신
    path('api-jwt-auth/verify/', TokenVerifyView.as_view()),   # JWT 토큰 확인
    path('', include('server.urls'))
]
示例#24
0
from django.urls import path
from rest_framework_simplejwt.views import (TokenObtainPairView,
                                            TokenRefreshView)
from .view import CreateUserView

app_name = "core"

urlpatterns = [
    path("signup/", CreateUserView.as_view(), name="signup"),
    path("token/", TokenObtainPairView.as_view(), name="token_obtain_pair"),
    path("token/refresh/", TokenRefreshView.as_view(), name="token_refresh"),
]
示例#25
0
from django.contrib import admin
from django.urls import path, include
from django.views.generic import TemplateView
from rest_framework_simplejwt.views import (
    TokenObtainPairView,
    TokenRefreshView,
)
    
urlpatterns = [
    path('api/v1/token/', TokenObtainPairView.as_view(), name='token_obtain_pair'),
    path('api/v1/token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
    ]

urlpatterns += [
    path('admin/', admin.site.urls),
    path('api/v1/', include('api.urls')),
    path('redoc/', TemplateView.as_view(template_name='redoc.html'), name='redoc'),
]
示例#26
0
文件: urls.py 项目: Wardomir/blog
    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 import routers
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView

from posts.views import PostView, LikeView, LikeStatisticsView
from user_management.views import UserViewSet, HelloView

router = routers.DefaultRouter()
router.register('users', UserViewSet)

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include(router.urls)),
    path('api/login/', TokenObtainPairView.as_view(),
         name='token_obtain_pair'),
    path('api/token/refresh/',
         TokenRefreshView.as_view(),
         name='token_refresh'),
    path('posts/', PostView.as_view(), name='posts'),
    path('posts/<int:pk>', PostView.as_view()),
    path('like/', LikeView.as_view()),
    path('likestats/', LikeStatisticsView.as_view()),
    path('hello', HelloView.as_view(), name='hello_view'),
]
示例#27
0
from django.conf.urls import url, include
from rest_framework import routers
from .views import QuestionViewSet, ChoiceViewSet
from rest_framework_simplejwt.views import (
    TokenObtainPairView,
    TokenRefreshView,
)

router = routers.DefaultRouter()
router.register(r'questions', QuestionViewSet, base_name='question')
router.register(r'choice', ChoiceViewSet, base_name='choice')

urlpatterns = [
    url(r'^api/', include(router.urls)),
    url(r'^api-auth/',
        include('rest_framework.urls', namespace='rest_framework')),
    url(r'^api/auth/token/obtain/$', TokenObtainPairView.as_view()),
    url(r'^api/auth/token/refresh/$', TokenRefreshView.as_view()),
]
示例#28
0
from rest_framework_simplejwt.views import (
    TokenObtainPairView,
    TokenRefreshView,
    TokenVerifyView,
)
from users import views as user_views

def i18n_javascript(request):
    return admin.site.i18n_javascript(request)


api_schema_view = get_swagger_view(title='PatrOwl Manager REST-API')

urlpatterns = [
    url(r'^apis-doc', api_schema_view),
    url(r'^auth-jwt/obtain_jwt_token/', TokenObtainPairView.as_view(), name='token_obtain_pair'),
    url(r'^auth-jwt/refresh_jwt_token/', TokenRefreshView.as_view(), name='token_refresh'),
    url(r'^auth-jwt/verify/', TokenVerifyView.as_view(), name='token_verify'),
    url(r'^admin/', admin.site.urls),
    url(r'^engines/', include('engines.urls')),
    url(r'^findings/', include('findings.urls')),
    url(r'^assets/', include('assets.urls')),
    url(r'^users/', include('users.urls')),
    url(r'^scans/', include('scans.urls')),
    url(r'^events/', include('events.urls')),
    url(r'^rules/', include('rules.urls')),
    url(r'^reportings/', include('reportings.urls')),
    url(r'^settings/', include('settings.urls')),
    url(r'^search', include('search.urls')),
    url(r'^', include('users.urls'), name='home'),
示例#29
0
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 django.conf import settings
from django.conf.urls.static import static
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView

from django.views.static import serve
from django.conf.urls import url

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('pages.urls')),
    path('api-auth/', include('rest_framework.urls')),
    path('api/token', TokenObtainPairView.as_view()),
    path('api/token/refresh/', TokenRefreshView.as_view()),
    url(r'^media/(?P<path>.*)$', serve,
        {'document_root': settings.MEDIA_ROOT}),
    url(r'^static/(?P<path>.*)$', serve,
        {'document_root': settings.STATIC_ROOT}),
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
示例#30
0
from classesapp import views
from rest_framework_simplejwt.views import TokenObtainPairView
urlpatterns = [
    path('admin/', admin.site.urls),
    path('classrooms/list/',
         views.ClassroomListAPIView.as_view(),
         name='api-classroom-list'),
    path('classrooms/detail/<int:classroom_id>/',
         views.ClassroomDetailAPIView.as_view(),
         name='api-classroom-detail'),
    path('classrooms/create/',
         views.ClassroomCreateAPIView.as_view(),
         name='api-classroom-create'),
    path('classrooms/update/<int:classroom_id>/',
         views.ClassroomUpdateView.as_view(),
         name='api-classroom-update'),
    path('classrooms/delete/<int:classroom_id>/',
         views.ClassroomDeleteView.as_view(),
         name='api-classroom-delete'),
    path('user/login/', TokenObtainPairView.as_view(), name="api-login"),
    path('user/register/',
         views.ClassroomCreateAPIView.as_view(),
         name="api-register"),
]

if settings.DEBUG:
    urlpatterns += static(settings.STATIC_URL,
                          document_root=settings.STATIC_ROOT)
    urlpatterns += static(settings.MEDIA_URL,
                          document_root=settings.MEDIA_ROOT)
示例#31
0
    TokenObtainPairView,
    TokenRefreshView,
)
from rest_framework import views, serializers, status
from rest_framework.response import Response
class EchoView(views.APIView):
    def post(self, request, *args, **kwargs):
        serializer = MessageSerializer(data=request.data)
        serializer.is_valid(raise_exception=True)
        return Response(
            serializer.data, status=status.HTTP_201_CREATED)




urlpatterns = [
    url(r'^$', generic.RedirectView.as_view(
         url='/api/', permanent=False)),
    url(r'^api/$', get_schema_view()),
    url(r'^api/auth/', include(
        'rest_framework.urls', namespace='rest_framework')),
    url(r'^api/auth/token/obtain/$', TokenObtainPairView.as_view()),
    url(r'^api/auth/token/refresh/$', TokenRefreshView.as_view()),
    url(r'^api/echo$', EchoView.as_view())
    ]





示例#32
0
    url(r'^random/?$',           reader_views.random_text_page),
    url(r'^daf-roulette/?$',     reader_views.daf_roulette_redirect),
    url(r'^chavruta/?$',     reader_views.chevruta_redirect),
]

# Registration
urlpatterns += [
    url(r'^login/?$', django_auth_views.LoginView.as_view(authentication_form=SefariaLoginForm), name='login'),
    url(r'^register/?$', sefaria_views.register, name='register'),
    url(r'^logout/?$', django_auth_views.LogoutView.as_view(), name='logout'),
    url(r'^password/reset/?$', django_auth_views.PasswordResetView.as_view(form_class=SefariaPasswordResetForm, email_template_name='registration/password_reset_email.txt', html_email_template_name='registration/password_reset_email.html'), name='password_reset'),
    url(r'^password/reset/confirm/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', django_auth_views.PasswordResetConfirmView.as_view(form_class=SefariaSetPasswordForm), name='password_reset_confirm'),
    url(r'^password/reset/complete/$', django_auth_views.PasswordResetCompleteView.as_view(), name='password_reset_complete'),
    url(r'^password/reset/done/$', django_auth_views.PasswordResetDoneView.as_view(), name='password_reset_done'),
    url(r'^api/register/$', sefaria_views.register_api),
    url(r'^api/login/$', TokenObtainPairView.as_view(), name='token_obtain_pair'),
    url(r'^api/login/refresh/$', TokenRefreshView.as_view(), name='token_refresh'),
]

# Compare Page
urlpatterns += [
    url(r'^compare/?((?P<comp_ref>[^/]+)/)?((?P<lang>en|he)/)?((?P<v1>[^/]+)/)?(?P<v2>[^/]+)?$', sefaria_views.compare)
]

# Gardens
urlpatterns += [
    #url(r'^garden/sheets/(?P<key>.+)$', 'sheet_tag_garden_page),
    url(r'^garden/(?P<key>.+)$', reader_views.custom_visual_garden_page),
    url(r'^garden/sheets/(?P<key>.+)$', reader_views.sheet_tag_visual_garden_page),
    url(r'^garden/search/(?P<q>.+)$', reader_views.search_query_visual_garden_page),
    url(r'^vgarden/custom/(?P<key>.*)$', reader_views.custom_visual_garden_page),  # legacy.  Used for "maggid" and "ecology"