简体   繁体   English

开发环境和AWS elastic beanstalk

[英]Development environment and AWS elastic beanstalk

In my Flask application, I have config.py-file that contains database configuration and firebase configuration json that contains all secret keys etc.在我的 Flask 应用程序中,我有包含数据库配置的 config.py 文件和包含所有密钥等的 firebase 配置 json。

How can I use different settings in my local development environment and production AWS EB environment?如何在我的本地开发环境和生产 AWS EB 环境中使用不同的设置? In local environment I connect to my local database and firebase development instance, in production I want to connect AWS RDS database and firebase production instance.在本地环境中,我连接到本地数据库和 firebase 开发实例,在生产环境中,我想连接 AWS RDS 数据库和 firebase 生产实例。

Is there any ways to change these configs on eb deploy?有什么方法可以在 eb deploy 上更改这些配置?

The best way would be to use ENV variables . 最好的方法是使用ENV variables (To follow the 12-Factor-App ) (要遵循12因素应用程序

To set ENV variables you could use eb setenv 要设置ENV variables ,可以使用eb setenv

Read more about os and dot_env阅读有关 os 和 dot_env 的更多信息

import os
from dotenv import load_dotenv

Here is more detailed documentation https://pypi.org/project/python-dotenv/这里有更详细的文档https://pypi.org/project/python-dotenv/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM