2016-11-11 18 views
0

作業中の理由から、名前またはコメントコードを変更せずに、プロジェクトの同じページを無効にする必要があります。私は、ユーザーpage_disabled.htmlに見せる必要がページ上でこれを置く@disable_page、のようなソリューションを必要とpythonフラスコ無効マニュピュレーションページ

@app.route('/about') 
def about(): 
    return render_template('about.html') 

:これは私のコード例です。これどうやってするの? @disable_pageデコレータは@app.route下に行かなければならない

def disabled(): 
    return render_template('page_disabled.html') 

def disable_page(func): 
    return disabled 

@app.route('/about') 
@disable_page 
def about(): 
    return render_template('about.html') 

答えて

0

のようなものを試してみてください。

+0

は機能上のみ可能ですか? defを無効にしました(func): return render_template( 'about.html') – selfmarket

関連する問題