当我只有一个网页启用时,网站可以正常工作(除了某些原因它有html5样板的默认橙色主题,当我改变它时,当我在本地运行它时工作正常,灰色主题)与以下代码在“flaskapp.py”文件中。
import os
from datetime import datetime
from flask import Flask, request, flash, url_for, redirect, \
render_template, abort, send_from_directory, session, escape
app = Flask(__name__)
app.config.from_pyfile('flaskapp.cfg')#This is the config file that is used by the server to see what it needs
@app.route('/')#The defualt page
def index():
return render_template('index.html') #Load the index html page
if __name__ == '__main__':
app.run(debug=True)
但是当我将其更改为以下内容时:
import os
from datetime import datetime
from flask import Flask, request, flash, url_for, redirect, \
render_template, abort, send_from_directory, session, escape
app = Flask(__name__)
app.config.from_pyfile('flaskapp.cfg')#This is the config file that is used by the server to see what it needs
@app.route('/')#The defualt page
def index():
return render_template('index.html') #Load the index html page
@app.route('/download-games')#The dpwnloads page
def download-games():
return "Download"
if __name__ == '__main__':
app.run(debug=True)
我得到503服务暂时不可用的错误。 HTML文件位于http://pastebin.com/32Ctsnjn
答案 0 :(得分:2)
Python方法名称中不允许使用连字符。
将其更改为
def download_games():
return "Download"