标签:flask静态文件
最近做一个项目,因为前端不厉害所以只单纯写了html 不做任何css js 就没有引入 ,
结果差不多了 要弄页面了 发现无法导入js css等静态文件。
以为是代码问题 研究2小时,无果
重新又写了几行代码
from flask import Flask,render_template
app = Flask(__name__)
@app.route(‘/‘)
def index():
return render_template(‘test.html‘)
if __name__=="__main__":
app.run(debug=True)
然后引入css
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<link rel="stylesheet" type="text/css" href="{{url_for(‘static‘,filename=‘style.css‘)}}">
</head>
<body>
test
</body>
</html>
google搜出来是把前面的<!doctype html>去掉, 一样无果,
实在没辙 根据错误查看 源码 找到 mimetypes.py 第260行 print查看变了为什么出错。
发现打印出这么一些变量:
<PyHKEY at 03B1FA40 (80000000)> -- *
<PyHKEY at 03B1FA40 (80000000)> -- .386
<PyHKEY at 03B1FA40 (80000000)> -- .3g2
<PyHKEY at 03B1FA40 (80000000)> -- .3gp
<PyHKEY at 03B1FA40 (80000000)> -- .3gp2
<PyHKEY at 03B1FA40 (80000000)> -- .3gpp
<PyHKEY at 03B1FA40 (80000000)> -- .3mf
<PyHKEY at 03B1FA40 (80000000)> -- .7z
<PyHKEY at 03B1FA40 (80000000)> -- .a
<PyHKEY at 03B1FA40 (80000000)> -- .aac
<PyHKEY at 03B1FA40 (80000000)> -- .ac3
<PyHKEY at 03B1FA40 (80000000)> -- .accountpicture-ms
<PyHKEY at 03B1FA40 (80000000)> -- .ace
<PyHKEY at 03B1FA40 (80000000)> -- .adt
<PyHKEY at 03B1FA40 (80000000)> -- .adts
<PyHKEY at 03B1FA40 (80000000)> -- .ai
<PyHKEY at 03B1FA40 (80000000)> -- .AIF
<PyHKEY at 03B1FA40 (80000000)> -- .AIFC
<PyHKEY at 03B1FA40 (80000000)> -- .AIFF
<PyHKEY at 03B1FA40 (80000000)> -- .amr
<PyHKEY at 03B1FA40 (80000000)> -- .AMV
<PyHKEY at 03B1FA40 (80000000)> -- .ani
<PyHKEY at 03B1FA40 (80000000)> -- .ans
<PyHKEY at 03B1FA40 (80000000)> -- .APE
<PyHKEY at 03B1FA40 (80000000)> -- .appcontent-ms
<PyHKEY at 03B1FA40 (80000000)> -- .application
<PyHKEY at 03B1FA40 (80000000)> -- .appref-ms
<PyHKEY at 03B1FA40 (80000000)> -- .appx
<PyHKEY at 03B1FA40 (80000000)> -- .appxbundle
<PyHKEY at 03B1FA40 (80000000)> -- .aps
<PyHKEY at 03B1FA40 (80000000)> -- .arc
<PyHKEY at 03B1FA40 (80000000)> -- .arj
<PyHKEY at 03B1FA40 (80000000)> -- .art
<PyHKEY at 03B1FA40 (80000000)> -- .arw
<PyHKEY at 03B1FA40 (80000000)> -- .asa
<PyHKEY at 03B1FA40 (80000000)> -- .asc
<PyHKEY at 03B1FA40 (80000000)> -- .ascx
<PyHKEY at 03B1FA40 (80000000)> -- .asf
<PyHKEY at 03B1FA40 (80000000)> -- .asm
<PyHKEY at 03B1FA40 (80000000)> -- .asmx
<PyHKEY at 03B1FA40 (80000000)> -- .asp
<PyHKEY at 03B1FA40 (80000000)> -- .aspx
<PyHKEY at 03B1FA40 (80000000)> -- .ASS
<PyHKEY at 03B1FA40 (80000000)> -- .ASX
<PyHKEY at 03B1FA40 (80000000)> -- .AU
<PyHKEY at 03B1FA40 (80000000)> -- .avi
。。。。。。。。。。。还有更多,找到最后出错前的哪一样0&?
<PyHKEY at 03B1FA40 (80000000)> -- 0&?
又搜google这个是干什么用的 最后发现是读取注册表,
果断regedit去看看,对的 发现是注册表问题并非程序问题,删之,结果这货提示无法删除
最后又花了1小时找到了N多个软件 最后找了一个删除, 之后正常了
PCHunter_free
标签:flask静态文件
原文地址:http://anngle.blog.51cto.com/5542868/1903141