codepedia2/Codepedia2/urls.py

46 lines
1.7 KiB
Python

"""Codepedia2 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, include
import xadmin
import debug_toolbar
from users.views import IndexView
from projects.views import FileListlView
from django.conf.urls.static import static
from django.conf import settings
# version模块自动注册需要版本控制的 Model
from xadmin.plugins import xversion
xversion.register_models()
urlpatterns = [
path('admin/', admin.site.urls),
path('xadmin/', xadmin.site.urls),
path('', IndexView.as_view(), name="index"),
path('captcha/', include('captcha.urls')),
path('projects/', include('projects.urls', namespace='projects')),
path('operations/', include('operations.urls', namespace='operations')),
path('files/', FileListlView.as_view(), name="files"),
path('users/', include('users.urls', namespace='users')),
# path('static/', serve, {'document_root': settings.STATIC_ROOT}),
# 第三方登陆
path('accounts/', include('allauth.urls')),
path('__debug__/', include(debug_toolbar.urls)),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)