T
T
theoctopus2017-03-08 16:28:44
Flask
theoctopus, 2017-03-08 16:28:44

Development DB and Production DB / How to implement in Flask?

Hello,

There was such task. It is necessary to make it so that during local development it uses the parameters of the local database, and after output to production it would use the main one.

But how can this be implemented in Flask? Is there a ready-made library for such a solution? Or is it somehow different?

Thank you in advance for your help.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry, 2017-03-08
@dmtrrr

1) Use two different configs
2) Take connection parameters from environment variables

D
Dimonchik, 2017-03-08
@dimonchik2013

import platform
LOCALHOSTNAME=platform.node()

or by IP

I
Ilya Demyanov, 2017-03-17
@turbidit

There is also official documentation with different options: flask-russian-docs.readthedocs.io/ru/latest/config...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question