添加伪静态后,访问请求的日志中有这个2023/03/2414:17:24[error]2439024#0:*82open()/www/wwwroot/site.com/frontend/we/dir/list-c2 html failed (2: No such file or directory), client: 1.1.1.1, server: site. comrequestGet/dir/1ist-c2.html?lang=1&page=17&prov-106&type1d-20HTTP1,host:www.site.com
时间: 2023-05-24 15:03:34 浏览: 213
这个错误信息看起来是 Nginx (或者其他Web服务器)的错误日志。一般情况下,如果你添加了伪静态规则或者其它的访问限制等设置,导致服务器无法成功处理访问请求,就有可能导致这种错误。建议检查一下您的伪静态规则设置,或者查看一下Nginx的错误日志详细信息,以便更好的解决这个问题。
相关问题
127.0.0.1 - - [14/May/2023 00:58:30] "GET / HTTP/1.1" 200 - 127.0.0.1 - - [14/May/2023 00:58:30] "GET /static/sweetalert/dist/sweetalert.css HTTP/1.1" 404 - 127.0.0.1 - - [14/May/2023 00:58:30] "GET /static/sweetalert/dist/sweetalert.min.js HTTP/1.1" 404 - [2023-05-14 00:58:32,535] ERROR in app: Exception on /login [GET] Traceback (most recent call last): File "F:\python\lib\site-packages\flask\app.py", line 2311, in wsgi_app response = self.full_dispatch_request() File "F:\python\lib\site-packages\flask\app.py", line 1834, in full_dispatch_request rv = self.handle_user_exception(e) File "F:\python\lib\site-packages\flask\app.py", line 1737, in handle_user_exception reraise(exc_type, exc_value, tb) File "F:\python\lib\site-packages\flask\_compat.py", line 36, in reraise raise value File "F:\python\lib\site-packages\flask\app.py", line 1832, in full_dispatch_request rv = self.dispatch_request() File "F:\python\lib\site-packages\flask\app.py", line 1818, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "G:\python\course_select_system-master\app\view.py", line 50, in login return render_template('login.html') File "F:\python\lib\site-packages\flask\templating.py", line 135, in render_template context, ctx.app) File "F:\python\lib\site-packages\flask\templating.py", line 117, in _render rv = template.render(context) File "F:\python\lib\site-packages\jinja2\asyncsupport.py", line 76, in render return original_render(self, *args, **kwargs) File "F:\python\lib\site-packages\jinja2\environment.py", line 1008, in render return self.environment.handle_exception(exc_info, True) File "F:\python\lib\site-packages\jinja2\environment.py", line 780, in handle_exception reraise(exc_type, exc_value, tb) File "F:\python\lib\site-packages\jinja2\_compat.py", line 37, in reraise raise value.with_traceback(tb) File "G:\python\course_select_system-master\app\templates\login.html", line 1, in top-level template code {% extends 'bootstrap/base.html' %} File "F:\python\lib\site-packages\flask_bootstrap\templates\bootstrap\base.html", line 1, in top-level template code {% block doc -%} File "F:\python\lib\site-packages\flask_bootstrap\templates\bootstrap\base.html", line 4, in block "doc" {%- block html %} File "F:\python\lib\site-packages\flask_bootstrap\templates\bootstrap\base.html", line 20, in block "html" {% block body -%} File "F:\python\lib\site-packages\flask_bootstrap\templates\bootstrap\base.html", line 26, in block "body" {% block scripts %} File "F:\python\lib\site-packages\flask_bootstrap\templates\bootstrap\base.html", line 27, in block "scripts" <script src="{{bootstrap_find_resource('jquery.js', cdn='jquery')}}"></script> jinja2.exceptions.UndefinedError: 'bootstrap_find_resource' is undefined 127.0.0.1 - - [14/May/2023 00:58:32] "GET /login HTTP/1.1" 500 -
这看起来是一个 Flask 应用程序的错误日志。从日志中可以看出,应用程序在处理 GET 请求时遇到了错误。具体来说,访问的静态文件没有找到,而且在渲染 login.html 模板时出现了一个未定义的变量 bootstrap_find_resource。这可能是因为在模板中使用了 Flask-Bootstrap 扩展,但是它没有正确安装或配置。你可以检查一下 Flask-Bootstrap 的安装和配置是否正确,或者尝试更换其他的静态文件库。
public void addInterceptors(InterceptorRegistry registry){ registry.addInterceptor(new MVCInterceptor()) .addPathPatterns("/**") .excludePathPatterns("/show_login") .excludePathPatterns("/check_login_mybatis") .excludePathPatterns("/no_privilege") .excludePathPatterns("/register") .excludePathPatterns("/js/*") .excludePathPatterns("/css/*") .excludePathPatterns("/image/*") .excludePathPatterns("/css/img/*") .excludePathPatterns("/error") .excludePathPatterns("/css/font/*") .excludePathPatterns("/*.js") .excludePathPatterns("/*.html") ; }
这段代码是在Spring MVC框架中注册拦截器,其中添加了一个MVCInterceptor拦截器,该拦截器会拦截所有的请求("/**"),但排除了一些特定的路径,如登录、注册、静态资源等。
拦截器可以在请求到达Controller之前或之后对请求进行处理,用于实现一些通用的功能,例如身份验证、日志记录等。在Spring MVC中,可以通过实现HandlerInterceptor接口来自定义拦截器,并通过InterceptorRegistry进行注册。在注册时,可以指定拦截的路径和排除的路径,以及拦截器的优先级等。
阅读全文