Managing the configuration: YAML File
Learn how to set up a config.yaml file.
We'll cover the following...
We'll cover the following...
Setting up a YAML file
Here is how we’ll set up the config.yaml
file to group configuration options together:
Press + to interact
dev_lite:DB: sqlite:///books.dbdev_postgres:DB: postgres://localhost:5432/books
When subsequent lines in a YAML file are indented like this, it means the values are nested. This will be read as the following dictionary of dictionaries in Python:
{ 'dev_lite': { 'DB':'sqlite:///books.db' },
'dev_postgres': { 'DB':'postgres://localhost:5432/books' } }
The YAML file will be used to describe two different environments. In the dev_lite
environment, which is the development environment using SQLite, the database connection string, DB
...