flask版本使用0.10版本。文件结构:/priceprice.py/templateslayout.htmlindex.htmlrate.html/staticstyle.css这是我的python代码:#-*-coding:utf-8-*-fromflaskimportFlask,render_templateapp=Flask(__name__)app.config.from_object(__name__)app.config.from_envvar('FLASKR_SETTINGS',silent=True)app.config.update(#DATABASE='/flaskr.db',DEBUG=True,SECRET_KEY='freightprice',USERNAME='admin',PASSWORD='Jake')@app.route("/")defindex():returnrender_template('index.html',page="index")@app.route('/rate')defrate():returnrender_template('rate.html',page="rate")@app.route('/update')defupdate():returnrender_template('update.html',page="update")if__name__=='__main__':app.run()layout.html代码HyunYoung|{{page}}{%blockbody%}{%endblock%}访问CSS的时候出现以下错误:UnicodeDecodeErrorUnicodeDecodeError:'ascii'codeccan'tdecodebyte0xceinposition3:ordinalnotinrange(128)Traceback(mostrecentcalllast)File"C:\Python27\lib\site-packages\flask\app.py",line1836,in__call__returnself.wsgi_app(environ,start_response)File"C:\Python27\lib\site-packages\flask\app.py",line1820,inwsgi_appresponse=self.make_response(self.handle_exception(e))File"C:\Python27\lib\site-packages\flask\app.py",line1403,inhandle_exceptionreraise(exc_type,exc_value,tb)File"C:\Python27\lib\site-packages\flask\app.py",line1817,inwsgi_appresponse=self.full_dispatch_request()File"C:\Python27\lib\site-packages\flask\app.py",line1477,infull_dispatch_requestrv=self.handle_user_exception(e)File"C:\Python27\lib\site-packages\flask\app.py",line1381,inhandle_user_exceptionreraise(exc_type,exc_value,tb)File"C:\Python27\lib\site-packages\flask\app.py",line1475,infull_dispatch_requestrv=self.dispatch_request()File"C:\Python27\lib\site-packages\flask\app.py",line1461,indispatch_requestreturnself.view_functions[rule.endpoint](**req.view_args)File"C:\Python27\lib\site-packages\flask\helpers.py",line822,insend_static_filecache_timeout=cache_timeout)File"C:\Python27\lib\site-packages\flask\helpers.py",line612,insend_from_directoryfilename=safe_join(directory,filename)File"C:\Python27\lib\site-packages\flask\helpers.py",line582,insafe_joinreturnos.path.join(directory,filename)File"C:\Python27\lib\ntpath.py",line108,injoinpath+="\\"+bUnicodeDecodeError:'ascii'codeccan'tdecodebyte0xceinposition3:ordinalnotinrange(128)ThedebuggercaughtanexceptioninyourWSGIapplication.Youcannowlookatthetracebackwhichledtotheerror.Toswitchbetweentheinteractivetracebackandtheplaintextone,youcanclickonthe"Traceback"headline.Fromthetexttracebackyoucanalsocreateapasteofit.Forcodeexecutionmouse-overtheframeyouwanttodebugandclickontheconsoleiconontherightside.YoucanexecutearbitraryPythoncodeinthestackframesandtherearesomeextrahelpersavailableforintrospection:dump()showsallvariablesintheframedump(obj)dumpsallthat'sknownabouttheobjectBroughttoyoubyDON'TPANIC,yourfriendlyWerkzeugpoweredtracebackinterpreter.css代码:使用UTF-8编码保存>*{>margin:0;>}>p{>color:red;>}
添加回答
举报
0/150
提交
取消