Changing defaults in Flask

TypeDefault folder name
Static assets(CSS, JS, images)static
Templates (Jinja, HTML)templates
Instance (configuration)instance
from flask import Flask
from flask import render_template

app = Flask(__name__,static_folder='assets',template_folder='templates_007',instance_path="/full_path_to_instance_folder/instance_007", instance_relative_config=True)
app.config.from_pyfile('config.py')

@app.route("/")
def hello():
 print app.config["DEBUG"]
 return render_template('index.html')

if __name__ == "__main__":
 app.run(debug=app.config["DEBUG"])

For complete code check github_repo

Reference: http://flask.pocoo.org/docs/0.10/api/

Other articles with the same tag

Back