I am creating an application according to the tutorial.
http://study-flask.readthedocs.io/ja/latest/02.html
While we are proceeding with the tutorial as shown in ,
import sqlite3
from flash import Flask, request, session, g, redirect, url_for, \
abort, render_template, flash
from contextlib import closing
DATABASE='/tmp/flaskr.db'
DEBUG = True
SECRET_KEY = 'development key'
USERNAME='admin'
PASSWORD = 'default'
app = Flask(__name__)
app.config.from_object(__name__)
The code came out.This,
app.config.from_object(__name__)
I don't know what the role is.In the tutorial, it was written that capitalization variables are collected, but what should I do after collecting them?
python flask
capitalization variable group written on the module
DATABASE='/tmp/flaskr.db'
DEBUG = True
SECRET_KEY = 'development key'
USERNAME='admin'
PASSWORD = 'default'
What did you mean by
Didn't you write it because you thought it was a Flask application configuration?
The line says, "This module is an object for configuring the Flask application, so please read the (uppercase-only variable) from this module as the configuration."
The configuration files themselves are actual Python files.Only
values in uppercase are actually stored in the config object later on.
Make sure to use uppercase letters for your config keys.
http://flask.pocoo.org/docs/1.0/config/ #configuring-from-files
© 2025 OneMinuteCode. All rights reserved.