Skip to content

Instantly share code, notes, and snippets.

@nycynik
Forked from mjul/application.py
Created November 28, 2016 08:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nycynik/e25a06f8e50c301343ecdc357437aebc to your computer and use it in GitHub Desktop.
Save nycynik/e25a06f8e50c301343ecdc357437aebc to your computer and use it in GitHub Desktop.
Configure a Python Flask application to use the associated Amazon RDS Postgres (or MySQL) database when running on Elastic Beanstalk (inside Docker).
driver = 'mysql+pymysql://'
driver = 'postgresql+psycopg2://'
app.config['SQLALCHEMY_DATABASE_URI'] = driver \
+ os.environ['RDS_USERNAME'] + ':' + os.environ['RDS_PASSWORD'] \
+'@' + os.environ['RDS_HOSTNAME'] + ':' + os.environ['RDS_PORT'] \
+ '/' + os.environ['RDS_DB_NAME']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment