【问题标题】:Openshift + flask wont allow more than one page to be enabledOpenshift + flask 不允许启用超过一页
【发布时间】:2016-01-14 02:54:35
【问题描述】:

当我只启用一个网页时,该网站可以正常工作(由于某种原因,它具有 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-3.x flask openshift jinja2


    【解决方案1】:

    Python 方法名称中不允许使用连字符。

    改成

    def download_games():
        return "Download"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多