How to create a separate config file with flask
First create a config.cfg file.
Contents:
HELLO='Hi!'
Then in your main python file for flusk (where you run everything):
app = Flask(__name__)
`app.config.from_pyfile('config.cfg')
And use it like so:
app.config['HELLO']
Written by Agam
Related protips
2 Responses
Looks like you have a typo in the title :)
over 1 year ago
·
I think that I fixed it, thanks!
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Python
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#