Openshift + flask 不允许启用多个页面
Openshift + flask wont allow more than one page to be enabled
当我只有一个网页启用时,网站可以正常工作(除了某些原因它有 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
Python 方法名称中不允许使用连字符。
改为
def download_games():
return "Download"
当我只有一个网页启用时,网站可以正常工作(除了某些原因它有 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
Python 方法名称中不允许使用连字符。
改为
def download_games():
return "Download"