1818from pathlib import Path
1919
2020from django .http import HttpResponse , HttpResponseRedirect
21- from django .templatetags .static import static as _static
2221from django .urls import path , re_path , include
2322from django .views import static
2423from rest_framework import status
@@ -109,7 +108,7 @@ def page_not_found(request, exception):
109108 in_ = [url for url in static_dict .get (chat_ui_prefix ) if request .path .endswith (url )]
110109 if len (in_ ) > 0 :
111110 a = chat_ui_prefix + in_ [0 ]
112- return HttpResponseRedirect (_static ( a ) )
111+ return HttpResponseRedirect (a )
113112 index_path = os .path .join (PROJECT_DIR , 'apps' , "static" , 'chat' , 'index.html' )
114113 content = get_index_html (index_path )
115114 content .replace ("prefix: '/chat'" , f"prefix: { CONFIG .get_chat_path ()} " )
@@ -120,7 +119,7 @@ def page_not_found(request, exception):
120119 in_ = [url for url in static_dict .get (admin_ui_prefix ) if request .path .endswith (url )]
121120 if len (in_ ) > 0 :
122121 a = admin_ui_prefix + in_ [0 ]
123- return HttpResponseRedirect (_static ( a ) )
122+ return HttpResponseRedirect (a )
124123 index_path = os .path .join (PROJECT_DIR , 'apps' , "static" , 'admin' , 'index.html' )
125124 if not os .path .exists (index_path ):
126125 return HttpResponse ("页面不存在" , status = 404 )
0 commit comments