示例#1
0
from django.conf.urls import include, url

#from django.contrib import admin
import xadmin

from xadmin.plugins import xversion
xversion.register_models()

urlpatterns = [
    url(r'^xadmin/', include(xadmin.site.urls),name='xadmin'),
    url(r'',include('blog.urls')),
]
示例#2
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.urls import path, re_path, include
from django.views import static
from django.conf import settings
import xadmin  # xadmin后台管理
from xadmin.plugins import xversion
from rest_framework import permissions
from drf_yasg.views import get_schema_view
from drf_yasg import openapi

xadmin.autodiscover()
xversion.register_models()  # xversion模块自动注册需要控制的版本Model(方便数据回滚)
#  换成自己的API文档配置
schema_view = get_schema_view(
    openapi.Info(
        title="皇室营地 API",
        default_version='v1',
        description="皇室营地 所有API接口说明",
        terms_of_service="https://api.xxx.com/",
        contact=openapi.Contact(email="*****@*****.**"),
        license=openapi.License(name="BSD License"),
    ),
    public=True,
    permission_classes=(permissions.IsAdminUser, ),
)

urlpatterns = [
示例#3
0
    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'))
"""
import xadmin

xadmin.autodiscover()
# xversion模块自动注册需要版本控制的 Model
from xadmin.plugins import xversion

xversion.register_models()

from django.urls import path, include, re_path
from django.views.static import serve
from django.conf import settings
from rest_framework.schemas import get_schema_view
from rest_framework_swagger.renderers import SwaggerUIRenderer, OpenAPIRenderer

schema_view = get_schema_view(
    title='API',
    public=True,
    renderer_classes=[OpenAPIRenderer, SwaggerUIRenderer])
urlpatterns = [
    path('xadmin/', xadmin.site.urls),
    path('user/', include('apps.user.urls')),
    path('test/', include('apps.tests.urls')),
示例#4
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'))
"""
import xadmin
# from import_export.admin import DEFAULT_FORMATS
# from import_export.admin import SKIP_ADMIN_LOG

from django.conf import settings
from django.conf.urls import url
from django.contrib import admin
from django.urls import path, include
from django.views.static import serve
from xadmin.plugins import xversion  # 导入 xadmin需要

xversion.register_models()  # 导入 xadmin需要

urlpatterns = [
    # 静态文件图片 url
    url(r'media/(?P<path>.*)', serve, {'document_root': settings.MEDIA_ROOT}),
    # path('admin/', admin.site.urls),
    path("ckeditor/", include("ckeditor_uploader.urls")),
    path('admin/', xadmin.site.urls),
    path('home/', include('home.urls')),
    path('user/', include('user.urls')),
    path('course/', include('course.urls')),
    path('cart/', include('cart.urls')),
    path('pay/', include('payments.urls')),
]