I am working on an app which looks similar to
facebook/
__init__.py
feed/
__init__.py
business.py
views.py
models/
persistence.py
user.py
chat/
__init__.py
models.py
business.py
views.py
config/
dev.py
test.py
prod.py
I want to have three environments Dev
, Test
and Production
.
I have the following requirements:
a.) When I start the server python runserver.py
, I would like to mention which environment I want to connect - Dev
, Test
or Production
.
b.) Dev
& Production
should have the schema built and just need to connect to machine
c.) I would also like for my test to connect to sqlite db
, and create the schema, run tests
How can I achieve this in a configuration manner so that I do not have to hardcode anything related to database.
Are there any good patterns available in flask?
Currently my runerver.py
has hardcoding for environment that I don't like,
app = Flask(__name__)
app.config['SECRET_KEY'] = dev.SECRET_KEY
I am looking for better ideas than I have