Discuss / Python / manage页面加载的css等request.path的问题

manage页面加载的css等request.path的问题

Topic source

水逸宁阳

#1 Created at ... [Delete] [Delete and Lock User]

廖老师你好:我碰到但解决不了这样一个问题。 当去以manage开头的页面(例如http://localhost:9000/manage/users )时:能够在response_factory中正确处理,用log获取最后返回的response的body内容,也是manage_users.html的完整内容。

但是log显示,为了显示该页面而读取相关的css文件等进入后续的logger_factory时,request.path 变成了/manage/static/css/uikit/.min.css而不是/static/css/uikit/.min.css。同时,经过测试显示如果@get('/manage/users') 改为@get('/manage/test/users') ,即url变成http://localhost:9000/manage/test/users 后, 获取css文件等时,相应的request.path 变成了/manage/test/static/css/uikit/.min.css。

问题是:url中的内容影响到了获取css等时的request.path,是在哪里影响的?另外url请求发出后,到middlewares拦截前,是怎样的过程。当前相应response_factory后到为了获取css文件等再次进入middlewares时是怎样的过程。

不方便的话请提示获取什么资料可以解决该问题即可。

colorsumer

#2 Created at ... [Delete] [Delete and Lock User]

我遇到过类似问题,注意: 每个路径开头是'/
不要写相对路径


  • 1

Reply