我使用的是Flask,版本是0.10_dev 这是我的应用代码
# -*- coding: utf-8 -*-
from flask import Flask, request, session, g, redirect, url_for, abort, \
render_template, flash, _app_ctx_stack
app = Flask(__name__)
app.config.update(
# DATABASE = '/flaskr.db',
DEBUG = True,
SECRET_KEY = 'freight price',
USERNAME = 'admin',
PASSWORD = 'Jake'
)
@app.route('/')
def index():
return render_template('index.html', page = "index")
# @app.route('/rate')
# def rate():
# return render_template('rate.html', page = "rate")
# @app.route('/update')
# def update():
# return render_template('update.html', page = "update")
if __name__ == '__main__':
app.run()
这是我的模板代码
<!DOCTYPE html>
<html>
<head>
<title>Hyun Young | {{ page }}</title>
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='style.css') }}">
</head>
<body>{% block body %}{% endblock %}
</body>
</html>
当我使用chrome检查错误时,chrome告诉我有500个HTTP状态代码。我试图直接检查css文件。有一个错误报告
UnicodeDecodeError UnicodeDecodeError:'ascii'编解码器无法解码字节 位置19的0xd4:序数不在范围内(128)
File "C:\Python27\lib\site-packages\flask\app.py", line 1836, in __call__ return self.wsgi_app(environ, start_response)
File "C:\Python27\lib\site-packages\flask\app.py", line 1820, in wsgi_app response = self.make_response(self.handle_exception(e))
File "C:\Python27\lib\site-packages\flask\app.py", line 1403, in handle_exception reraise(exc_type, exc_value, tb) File "C:\Python27\lib\site-packages\flask\app.py", line 1817, in wsgi_app response = self.full_dispatch_request()
File "C:\Python27\lib\site-packages\flask\app.py", line 1477, in full_dispatch_request rv = self.handle_user_exception(e) File "C:\Python27\lib\site-packages\flask\app.py", line 1381, in handle_user_exception reraise(exc_type, exc_value, tb)
File "C:\Python27\lib\site-packages\flask\app.py", line 1475, in full_dispatch_request rv = self.dispatch_request()
File "C:\Python27\lib\site-packages\flask\app.py", line 1461, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args)
File "C:\Python27\lib\site-packages\flask\helpers.py", line 822, in send_static_file cache_timeout=cache_timeout)
File "C:\Python27\lib\site-packages\flask\helpers.py", line 612, in send_from_directory filename = safe_join(directory, filename) File "C:\Python27\lib\site--packages\flask\helpers.py", line 582, in safe_join return os.path.join(directory, filename)
File "C:\Python27\lib\ntpath.py", line 108, in join Display the sourcecode for this frameOpen an interactive python shell in this framepath += "\\" + b