diff --git a/itsm/api/v1.py b/itsm/api/v1.py index 0a86b0a92..986e73b55 100644 --- a/itsm/api/v1.py +++ b/itsm/api/v1.py @@ -24,7 +24,7 @@ """ -from django.conf.urls import include, url +from django.urls import include, re_path __author__ = "蓝鲸智云" @@ -38,35 +38,35 @@ urlpatterns = [ # 流程管理模块 - url(r"^workflow/", include("itsm.workflow.urls")), + re_path(r"^workflow/", include("itsm.workflow.urls")), # 单据模块 - url(r"^ticket/", include("itsm.ticket.urls")), + re_path(r"^ticket/", include("itsm.ticket.urls")), # 任务模块 - url(r"^task/", include("itsm.task.urls")), + re_path(r"^task/", include("itsm.task.urls")), # 服务模块 - url(r"^service/", include("itsm.service.urls")), + re_path(r"^service/", include("itsm.service.urls")), # sla模块 - url(r"^sla/", include("itsm.sla.urls")), + re_path(r"^sla/", include("itsm.sla.urls")), # postman - url(r"^postman/", include("itsm.postman.urls")), + re_path(r"^postman/", include("itsm.postman.urls")), # 角色模块 - url(r"^role/", include("itsm.role.urls")), + re_path(r"^role/", include("itsm.role.urls")), # iadmin - url(r"^iadmin/", include("itsm.iadmin.urls")), + re_path(r"^iadmin/", include("itsm.iadmin.urls")), # 网关转发模块,目前主要用于转发esb侧的接口调用 - url(r"^gateway/", include("itsm.gateway.urls")), + re_path(r"^gateway/", include("itsm.gateway.urls")), # "杂种"模块,没有model,且不知道放哪里合适,就放到这个模块吧! - url(r"^misc/", include("itsm.misc.urls")), + re_path(r"^misc/", include("itsm.misc.urls")), # 单据状态模块 - url(r"^ticket_status/", include("itsm.ticket_status.urls")), + re_path(r"^ticket_status/", include("itsm.ticket_status.urls")), # Trigger Module - url(r"^trigger/", include("itsm.trigger.urls")), + re_path(r"^trigger/", include("itsm.trigger.urls")), # iam - url(r"^iam/", include("itsm.auth_iam.urls")), + re_path(r"^iam/", include("itsm.auth_iam.urls")), # iam - url(r"^project/", include("itsm.project.urls")), + re_path(r"^project/", include("itsm.project.urls")), # 人员选择器 - url(r"^c/compapi/v2/usermanage/fs_list_users/$", get_batch_users), + re_path(r"^c/compapi/v2/usermanage/fs_list_users/$", get_batch_users), # 蓝鲸插件服务 - url(r"^plugin_service/", include("itsm.plugin_service.urls")), + re_path(r"^plugin_service/", include("itsm.plugin_service.urls")), ] diff --git a/itsm/auth_iam/urls.py b/itsm/auth_iam/urls.py index f3d10cbf2..caa93ce5c 100644 --- a/itsm/auth_iam/urls.py +++ b/itsm/auth_iam/urls.py @@ -24,7 +24,7 @@ """ from django.conf import settings -from django.conf.urls import url +from django.urls import re_path from rest_framework.routers import DefaultRouter from iam import IAM @@ -46,7 +46,12 @@ from itsm.auth_iam.views import ResourceViewSet, PermissionViewSet from itsm.auth_iam.resources import ProjectResourceProvider -iam = IAM(settings.APP_CODE, settings.SECRET_KEY, settings.BK_IAM_INNER_HOST, settings.BK_PAAS_HOST) +iam = IAM( + settings.APP_CODE, + settings.SECRET_KEY, + settings.BK_IAM_INNER_HOST, + settings.BK_PAAS_HOST, +) routers = DefaultRouter(trailing_slash=True) @@ -70,5 +75,5 @@ dispatcher.register("task_template", TaskSchemaResourceProvider()) dispatcher.register("public_api", PublicApiResourceProvider()) urlpatterns = routers.urls + [ - url(r'^resources/v1/$', dispatcher.as_view([login_exempt])), + re_path(r"^resources/v1/$", dispatcher.as_view([login_exempt])), ] diff --git a/itsm/gateway/urls.py b/itsm/gateway/urls.py index dc640dc3e..b4ae38628 100644 --- a/itsm/gateway/urls.py +++ b/itsm/gateway/urls.py @@ -26,56 +26,58 @@ __author__ = "蓝鲸智云" __copyright__ = "Copyright © 2012-2020 Tencent BlueKing. All Rights Reserved." -from django.conf.urls import url +from django.urls import re_path from itsm.gateway import views urlpatterns = [ - url(r"^test/token/$", views.get_token), - url(r"^bk_login/get_batch_users/$", views.get_batch_users), - url(r"^bk_login/get_all_users/$", views.get_all_users), - url(r"^cmdb/get_app_list/$", views.get_app_list), - url(r"^usermanage/get_departments/$", views.get_departments), - url( + re_path(r"^test/token/$", views.get_token), + re_path(r"^bk_login/get_batch_users/$", views.get_batch_users), + re_path(r"^bk_login/get_all_users/$", views.get_all_users), + re_path(r"^cmdb/get_app_list/$", views.get_app_list), + re_path(r"^usermanage/get_departments/$", views.get_departments), + re_path( r"^usermanage/get_first_level_departments/$", views.get_first_level_departments ), - url(r"^usermanage/get_department_info/$", views.get_department_info), - url(r"^usermanage/get_department_users/$", views.get_department_users), - url(r"^usermanage/get_department_users_count/$", views.get_department_users_count), - url(r"^usermanage/get_user_info/$", views.get_user_info), - url(r"^sops/get_user_project_list/$", views.get_user_project_list), - url(r"^sops/get_template_list/$", views.get_template_list), - url(r"^sops/get_template_detail/$", views.get_template_detail), - url(r"^sops/get_unfinished_sops_tasks/$", views.get_unfinished_sops_tasks), - url(r"^sops/get_sops_tasks/$", views.get_sops_tasks), - url(r"^sops/get_sops_tasks_detail/$", views.get_sops_tasks_detail), - url(r"^sops/get_sops_template_schemes/$", views.get_sops_template_schemes), - url(r"^sops/get_sops_preview_task_tree/$", views.get_sops_preview_task_tree), - url( + re_path(r"^usermanage/get_department_info/$", views.get_department_info), + re_path(r"^usermanage/get_department_users/$", views.get_department_users), + re_path( + r"^usermanage/get_department_users_count/$", views.get_department_users_count + ), + re_path(r"^usermanage/get_user_info/$", views.get_user_info), + re_path(r"^sops/get_user_project_list/$", views.get_user_project_list), + re_path(r"^sops/get_template_list/$", views.get_template_list), + re_path(r"^sops/get_template_detail/$", views.get_template_detail), + re_path(r"^sops/get_unfinished_sops_tasks/$", views.get_unfinished_sops_tasks), + re_path(r"^sops/get_sops_tasks/$", views.get_sops_tasks), + re_path(r"^sops/get_sops_tasks_detail/$", views.get_sops_tasks_detail), + re_path(r"^sops/get_sops_template_schemes/$", views.get_sops_template_schemes), + re_path(r"^sops/get_sops_preview_task_tree/$", views.get_sops_preview_task_tree), + re_path( r"^sops/get_sops_preview_common_task_tree/$", views.get_sops_preview_common_task_tree, ), - url(r"^devops/get_user_pipeline_list/$", views.get_user_pipeline_list), - url(r"^devops/get_user_projects/$", views.get_user_projects), - url( + re_path(r"^devops/get_user_pipeline_list/$", views.get_user_pipeline_list), + re_path(r"^devops/get_user_projects/$", views.get_user_projects), + re_path( r"^devops/get_pipeline_build_start_info/$", views.get_pipeline_build_start_info ), - url(r"^devops/get_user_pipeline_detail/$", views.get_user_pipeline_detail), - url(r"^devops/get_pipeline_build_list/$", views.get_pipeline_build_list), - url(r"^devops/start_user_pipeline/$", views.start_user_pipeline), - url( + re_path(r"^devops/get_user_pipeline_detail/$", views.get_user_pipeline_detail), + re_path(r"^devops/get_pipeline_build_list/$", views.get_pipeline_build_list), + re_path(r"^devops/start_user_pipeline/$", views.start_user_pipeline), + re_path( r"^devops/get_user_pipeline_build_status/$", views.get_user_pipeline_build_status, ), - url( + re_path( r"^devops/get_user_pipeline_build_detail/$", views.get_user_pipeline_build_detail, ), - url( + re_path( r"^devops/get_pipeline_build_artifactory/$", views.get_pipeline_build_artifactory, ), - url( + re_path( r"^devops/get_pipeline_build_artifactory_download_url/$", views.get_pipeline_build_artifactory_download_url, ), diff --git a/itsm/helper/urls.py b/itsm/helper/urls.py index 5d92b79eb..873e0eeb6 100644 --- a/itsm/helper/urls.py +++ b/itsm/helper/urls.py @@ -26,39 +26,45 @@ __author__ = "蓝鲸智云" __copyright__ = "Copyright © 2012-2020 Tencent BlueKing. All Rights Reserved." -from django.conf.urls import url +from django.urls import re_path from itsm.helper import views urlpatterns = [ # 统一的升级接口 - url(r'^db_fix_from_1_1_22_to_2_1_16/$', views.db_fix_from_1_1_22_to_2_1_16), - url(r'^db_fix_from_2_1_x_to_2_2_1/$', views.db_fix_from_2_1_x_to_2_2_1), - url(r'^db_fix_after_2_2_17/$', views.db_fix_after_2_2_17), - url(r'^db_fix_after_2_3_1/$', views.db_fix_after_2_3_1), + re_path(r"^db_fix_from_1_1_22_to_2_1_16/$", views.db_fix_from_1_1_22_to_2_1_16), + re_path(r"^db_fix_from_2_1_x_to_2_2_1/$", views.db_fix_from_2_1_x_to_2_2_1), + re_path(r"^db_fix_after_2_2_17/$", views.db_fix_after_2_2_17), + re_path(r"^db_fix_after_2_3_1/$", views.db_fix_after_2_3_1), # 杂乱的升级接口 - url(r'^fix_ticket_title/$', views.fix_ticket_title), - url(r'^update_logs_type/$', views.update_logs_type), - url(r'^db_fix_after_2_0_3/$', views.db_fix_after_2_0_3), - url(r'^db_fix_ticket_end_at_after_2_0_5/$', views.db_fix_ticket_end_at_after_2_0_5), - url(r'^db_fix_deal_time_after_2_0_5/$', views.db_fix_deal_time_after_2_0_5), - url(r'^db_fix_after_2_0_7/$', views.db_fix_after_2_0_7), - url(r'^db_fix_after_2_0_9/$', views.db_fix_after_2_0_9), - url(r'^db_fix_after_2_0_14/$', views.db_fix_after_2_0_14), - url(r'^db_fix_after_2_1_x/$', views.db_fix_after_2_1_x), - url(r'^db_fix_after_2_1_1/$', views.db_fix_after_2_1_1), - url(r'^db_fix_sla/$', views.db_fix_sla), - url(r'^db_fix_after_2_1_9/$', views.db_fix_after_2_1_9), - url(r'^export_api_system/$', views.export_api_system), - url(r'^db_fix_for_attachments/$', views.db_fix_for_attachments), - url(r'^db_fix_for_service_catalog/$', views.db_fix_for_service_catalog), - url(r'^weekly_statical/$', views.weekly_statical), - url(r'^db_fix_for_workflow_after_2_5_9/$', views.db_fix_for_workflow_after_2_5_9), - url(r'^db_fix_for_blueapps_after_2_6_0/$', views.db_fix_for_blueapps_after_2_6_0), + re_path(r"^fix_ticket_title/$", views.fix_ticket_title), + re_path(r"^update_logs_type/$", views.update_logs_type), + re_path(r"^db_fix_after_2_0_3/$", views.db_fix_after_2_0_3), + re_path( + r"^db_fix_ticket_end_at_after_2_0_5/$", views.db_fix_ticket_end_at_after_2_0_5 + ), + re_path(r"^db_fix_deal_time_after_2_0_5/$", views.db_fix_deal_time_after_2_0_5), + re_path(r"^db_fix_after_2_0_7/$", views.db_fix_after_2_0_7), + re_path(r"^db_fix_after_2_0_9/$", views.db_fix_after_2_0_9), + re_path(r"^db_fix_after_2_0_14/$", views.db_fix_after_2_0_14), + re_path(r"^db_fix_after_2_1_x/$", views.db_fix_after_2_1_x), + re_path(r"^db_fix_after_2_1_1/$", views.db_fix_after_2_1_1), + re_path(r"^db_fix_sla/$", views.db_fix_sla), + re_path(r"^db_fix_after_2_1_9/$", views.db_fix_after_2_1_9), + re_path(r"^export_api_system/$", views.export_api_system), + re_path(r"^db_fix_for_attachments/$", views.db_fix_for_attachments), + re_path(r"^db_fix_for_service_catalog/$", views.db_fix_for_service_catalog), + re_path(r"^weekly_statical/$", views.weekly_statical), + re_path( + r"^db_fix_for_workflow_after_2_5_9/$", views.db_fix_for_workflow_after_2_5_9 + ), + re_path( + r"^db_fix_for_blueapps_after_2_6_0/$", views.db_fix_for_blueapps_after_2_6_0 + ), # 获取settings内容 ] # urlpatterns += [ -# url(r'^dump_db/$', views_common.dump_db), -# url(r'^drop_table/$', views_common.drop_table), +# re_path(r'^dump_db/$', views_common.dump_db), +# re_path(r'^drop_table/$', views_common.drop_table), # ] diff --git a/itsm/misc/urls.py b/itsm/misc/urls.py index becbdbb6c..d387183f4 100644 --- a/itsm/misc/urls.py +++ b/itsm/misc/urls.py @@ -23,12 +23,12 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ -from django.conf.urls import url +from django.urls import re_path from itsm.misc import views urlpatterns = [ - url(r"^upload_file/$", views.upload), - url(r"^download_file/$", views.download), - url(r"^clean_cache/$", views.clean_cache), + re_path(r"^upload_file/$", views.upload), + re_path(r"^download_file/$", views.download), + re_path(r"^clean_cache/$", views.clean_cache), ] diff --git a/itsm/monitor/urls.py b/itsm/monitor/urls.py index 3970f35ed..0f1292ac9 100644 --- a/itsm/monitor/urls.py +++ b/itsm/monitor/urls.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -from django.conf.urls import url +from django.urls import re_path, path from itsm.monitor.views import healthz, ping urlpatterns = [ # main - url(r"^healthz/$", healthz), - url(r"ping/$", ping), + re_path(r"^healthz/$", healthz), + path(r"ping/$", ping), ] diff --git a/itsm/openapi/devops_plugin/urls.py b/itsm/openapi/devops_plugin/urls.py index d49b2ae6f..b9c904be8 100644 --- a/itsm/openapi/devops_plugin/urls.py +++ b/itsm/openapi/devops_plugin/urls.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -from django.conf.urls import url +from django.urls import re_path from itsm.openapi.devops_plugin import views urlpatterns = [ # main - url(r"^devops_plugin/services/$", views.services), - url(r"^devops_plugin/fields/$", views.service_fields), + re_path(r"^devops_plugin/services/$", views.services), + re_path(r"^devops_plugin/fields/$", views.service_fields), ] diff --git a/itsm/plugin_service/README.md b/itsm/plugin_service/README.md index 50940eaba..f31f78f8c 100644 --- a/itsm/plugin_service/README.md +++ b/itsm/plugin_service/README.md @@ -22,7 +22,7 @@ INSTALLED_APPS += ( ``` python urlpatterns = [ ..., - url(r"^plugin_service/", include("plugin_service.urls")), + re_path(r"^plugin_service/", include("plugin_service.urls")), ..., ] ``` diff --git a/itsm/plugin_service/docs/openapi_config.md b/itsm/plugin_service/docs/openapi_config.md index 72abbd542..6295c249e 100644 --- a/itsm/plugin_service/docs/openapi_config.md +++ b/itsm/plugin_service/docs/openapi_config.md @@ -16,9 +16,9 @@ ) urlpatterns += [ - url(r"^swagger(?P\.json|\.yaml)$", schema_view.without_ui(cache_timeout=0), name="schema-json"), - url(r"^swagger/$", schema_view.with_ui("swagger", cache_timeout=0), name="schema-swagger-ui"), - url(r"^redoc/$", schema_view.with_ui("redoc", cache_timeout=0), name="schema-redoc"), + re_path(r"^swagger(?P\.json|\.yaml)$", schema_view.without_ui(cache_timeout=0), name="schema-json"), + re_path(r"^swagger/$", schema_view.with_ui("swagger", cache_timeout=0), name="schema-swagger-ui"), + re_path(r"^redoc/$", schema_view.with_ui("redoc", cache_timeout=0), name="schema-redoc"), ] ``` diff --git a/itsm/plugin_service/urls.py b/itsm/plugin_service/urls.py index 7f3d4ced3..305b35604 100644 --- a/itsm/plugin_service/urls.py +++ b/itsm/plugin_service/urls.py @@ -11,19 +11,19 @@ specific language governing permissions and limitations under the License. """ -from django.conf.urls import url +from django.urls import re_path from . import api urlpatterns = [ - url(r"^list/$", api.get_plugin_list), - url(r"^detail_list/$", api.get_plugin_detail_list), - url(r"^meta/$", api.get_meta), - url(r"^detail/$", api.get_plugin_detail), - url(r"^logs/$", api.get_logs), - url(r"^app_detail/$", api.get_plugin_app_detail), - url( + re_path(r"^list/$", api.get_plugin_list), + re_path(r"^detail_list/$", api.get_plugin_detail_list), + re_path(r"^meta/$", api.get_meta), + re_path(r"^detail/$", api.get_plugin_detail), + re_path(r"^logs/$", api.get_logs), + re_path(r"^app_detail/$", api.get_plugin_app_detail), + re_path( r"^data_api/(?P.+?)/(?P.+)$", api.get_plugin_api_data, ), diff --git a/itsm/postman/urls.py b/itsm/postman/urls.py index df87d3a1e..daaa09732 100644 --- a/itsm/postman/urls.py +++ b/itsm/postman/urls.py @@ -23,7 +23,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ -from django.conf.urls import url +from django.urls import re_path from rest_framework.routers import DefaultRouter from itsm.postman.views import ( @@ -36,13 +36,13 @@ routers = DefaultRouter(trailing_slash=True) -routers.register(r'api_instance', ApiInstanceViewsSet, basename="api_instance") +routers.register(r"api_instance", ApiInstanceViewsSet, basename="api_instance") -routers.register(r'remote_system', RemoteSystemViewSet, basename='remote_system') +routers.register(r"remote_system", RemoteSystemViewSet, basename="remote_system") -routers.register(r'remote_api', RemoteApiViewSet, basename='remote_api') +routers.register(r"remote_api", RemoteApiViewSet, basename="remote_api") # APIView不能通过routers.register()的方式注入路由 urlpatterns = routers.urls + [ - url(r'^rpc_api/$', RpcApiViewSet.as_view()), + re_path(r"^rpc_api/$", RpcApiViewSet.as_view()), ] diff --git a/itsm/sites/urls.py b/itsm/sites/urls.py index 17063dfc8..451bbdf4c 100644 --- a/itsm/sites/urls.py +++ b/itsm/sites/urls.py @@ -23,7 +23,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ -from django.conf.urls import include, url +from django.urls import include, re_path from django_nyt.urls import get_pattern as get_nyt_pattern from itsm.sites.views import index, get_footer, init @@ -31,17 +31,17 @@ urlpatterns = [ # main - url(r"^$", index), - url(r"^init/$", init), + re_path(r"^$", index), + re_path(r"^init/$", init), # flower, celery monitor - url(r"^o/bk_sops/", include("sops_proxy.urls")), + re_path(r"^o/bk_sops/", include("sops_proxy.urls")), # helper, fix database - url(r"^helper/", include("itsm.helper.urls")), + re_path(r"^helper/", include("itsm.helper.urls")), # weixin - url(r"^weixin/$", weixin_views.index), - url(r"^weixin/login/", include("weixin.core.urls")), - url(r"^weixin/api/", include("weixin.urls")), + re_path(r"^weixin/$", weixin_views.index), + re_path(r"^weixin/login/", include("weixin.core.urls")), + re_path(r"^weixin/api/", include("weixin.urls")), # wiki - url(r"^notifications/", get_nyt_pattern()), - url(r"^core/footer/$", get_footer), + re_path(r"^notifications/", get_nyt_pattern()), + re_path(r"^core/footer/$", get_footer), ] diff --git a/itsm/trigger/urls.py b/itsm/trigger/urls.py index 69aace4e5..6b9d3342d 100644 --- a/itsm/trigger/urls.py +++ b/itsm/trigger/urls.py @@ -23,7 +23,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ -from django.conf.urls import url +from django.urls import re_path from rest_framework.routers import DefaultRouter from itsm.trigger.views import ( @@ -41,4 +41,4 @@ routers.register(r"actions", ActionViewSet, basename="actions") -urlpatterns = routers.urls + [url(r'^components/$', ComponentApiViewSet.as_view())] +urlpatterns = routers.urls + [re_path(r"^components/$", ComponentApiViewSet.as_view())] diff --git a/sops_proxy/urls.py b/sops_proxy/urls.py index 738faf4d2..4fe74726f 100644 --- a/sops_proxy/urls.py +++ b/sops_proxy/urls.py @@ -23,14 +23,14 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ -from django.conf.urls import url +from django.urls import re_path from sops_proxy.views import SopsProxy urlpatterns = [ # 插件静态资源(jsonp)转发 - # url(r"^static/(?P.*)$", dispatch_static), + # re_path(r"^static/(?P.*)$", dispatch_static), # 插件请求(ajax)转发 - # url(r"^(?P.*)$", dispatch_query), - url(r"^(?P.*)$", SopsProxy.as_view()), + # re_path(r"^(?P.*)$", dispatch_query), + re_path(r"^(?P.*)$", SopsProxy.as_view()), ] diff --git a/urls.py b/urls.py index f0d9fccf5..6efd83e71 100644 --- a/urls.py +++ b/urls.py @@ -24,7 +24,7 @@ """ from django.conf import settings -from django.conf.urls import include, url +from django.urls import include, re_path # Uncomment the next two lines to enable the admin: from django.contrib import admin @@ -33,22 +33,22 @@ # 公共URL配置 urlpatterns = [ # Django后台数据库管理® - url(r"^admin/", admin.site.urls), - url(r"^notice/", include("bk_notice_sdk.urls")), + re_path(r"^admin/", admin.site.urls), + re_path(r"^notice/", include("bk_notice_sdk.urls")), # 用户登录鉴权 - # url(r'^account/', include('account.urls')), - url(r"^account/", include("blueapps.account.urls")), + # re_path(r'^account/', include('account.urls')), + re_path(r"^account/", include("blueapps.account.urls")), # 接口版本管理 - url(r"^api/", include("itsm.api.v1")), + re_path(r"^api/", include("itsm.api.v1")), # 对外开放的接口 - url(r"^openapi/", include("itsm.api.open_v1")), - url(r"^openapi/v2/", include("itsm.api.open_v2")), + re_path(r"^openapi/", include("itsm.api.open_v1")), + re_path(r"^openapi/v2/", include("itsm.api.open_v2")), # 监控,普罗米修斯相关的接口 - url(r"^monitor/", include("itsm.monitor.urls")), + re_path(r"^monitor/", include("itsm.monitor.urls")), # 各种入口:微信/wiki/首页等 - url(r"^", include("itsm.sites.urls")), + re_path(r"^", include("itsm.sites.urls")), # eri admin - url(r"^eri/admin/", include("pipeline.contrib.engine_admin.urls")), + re_path(r"^eri/admin/", include("pipeline.contrib.engine_admin.urls")), ] handler404 = "error_pages.views.error_404" @@ -62,5 +62,7 @@ # 全局生效:不推荐生产环境使用 urlpatterns += [ # wiki上传图片404也可以这样简单解决:路由层面不复用MEDIA_URL,后者只用来生成url,比如可以自定义prefix为SITE_URL - url(r"^media/(?P.*)$", static.serve, {"document_root": settings.MEDIA_ROOT}), + re_path( + r"^media/(?P.*)$", static.serve, {"document_root": settings.MEDIA_ROOT} + ), ] diff --git a/weixin/README.md b/weixin/README.md index 788a1f6bb..a2937a858 100644 --- a/weixin/README.md +++ b/weixin/README.md @@ -35,8 +35,8 @@ * 修改urls.py文件 ```python # urlpatterns 添加 - url(r'^weixin/login/', include('weixin.core.urls')), - url(r'^weixin/', include('weixin.urls')), + re_path(r'^weixin/login/', include('weixin.core.urls')), + re_path(r'^weixin/', include('weixin.urls')), ``` ## 蓝鲸应用 * 部署蓝鲸应用 diff --git a/weixin/core/urls.py b/weixin/core/urls.py index 6993662e3..ac5bd34f7 100644 --- a/weixin/core/urls.py +++ b/weixin/core/urls.py @@ -23,11 +23,11 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ -from django.conf.urls import url +from django.urls import re_path from . import views urlpatterns = [ - url(r'^$', views.login, name='weixin_login'), + re_path(r"^$", views.login, name="weixin_login"), ] diff --git a/weixin/urls.py b/weixin/urls.py index 812b3d849..24f0f8c11 100644 --- a/weixin/urls.py +++ b/weixin/urls.py @@ -23,7 +23,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ -from django.conf.urls import include, url +from django.urls import include, re_path from rest_framework.routers import DefaultRouter from itsm.misc.views import download, upload @@ -66,9 +66,9 @@ routers.register(r"task/tasks", WXTaskViewSet, basename="wx_tasks") urlpatterns = routers.urls + [ - url(r"^gateway/", include("itsm.gateway.urls")), - url(r"^upload_file/$", upload), - url(r"^download_file/$", download), - url(r"^postman/rpc_api/$", WXRpcApiViewSet.as_view()), - url(r"^c/compapi/v2/usermanage/fs_list_users/$", get_batch_users), + re_path(r"^gateway/", include("itsm.gateway.urls")), + re_path(r"^upload_file/$", upload), + re_path(r"^download_file/$", download), + re_path(r"^postman/rpc_api/$", WXRpcApiViewSet.as_view()), + re_path(r"^c/compapi/v2/usermanage/fs_list_users/$", get_batch_users), ]