1、運行flask報錯
ModuleNotFoundError: No module named 'flask._compat'
問題解析:該問題一般是flask版本太高,高版本好像沒有了'flask._compat'所以報錯。降低flask版本即可解決
pip uninstall flask
pip install flask==1.1.4
2、報錯
tzlocal.utils.ZoneInfoNotFoundError: 'Multiple conflicting time zone configurations
found:\n/etc/timezone: Asia/Shanghai\n/etc/localtime is a symlink to: PRC\nFix the configuration,
or set the time zone in a TZ environment variable.\n'
問題解析:該問題是因為時區導致的問題。一個是timezone一個是localtime
vim /etc/timezone #查看設置的是否是Asia/Shanghai
rm -f /etc/localtime
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
3、使用zipfile壓縮文件報錯
給壓縮包起名時,文件名內一定不能有/,有斜杠找不到路徑(害苦了我了)
4、啟動項目失敗
報錯地址已經在使用OSError: [Errno 98] Address already in use
問題解析:一半是上次關閉flask項目表面關上了,但是后台還在運行
#解決方法
netstat -tunlp
#找到被占用的地址的pid
kill -9 pid(占用地址的pid)
5、flask項目運行后,chrome一直下載緩存中的文件
在下載獲取到response對象后,增加headers 設置 cache-controll = “no-store“

