I used tornado to create a simple page. The css in the result page is loaded, but has no effect. Use Google Chrome to debug, it says Resource interpreted as Stylesheet but transferred with MIME type application/x-css. The general meaning is that the css file is recognized as a style sheet, but it is transferred in application/x-css format. This causes the browser to be unable to display the page properly and the css to not work at all. The reason is that web.py in tornadod will call mimetypes.guess_type()
when setting content_type. And when mimetypes is initialized, if In the windows environment, the local registry will be read.
So just change the Content Type of the css file in the registry from applicntion/x-css
to text/css is enough.
The above is the detailed content of The solution to the problem that tornado has no effect after loading css. For more information, please follow other related articles on the PHP Chinese website!