Skip to content

Commit

Permalink
Enviroment Variables set
Browse files Browse the repository at this point in the history
  • Loading branch information
gpivaro committed Dec 6, 2020
1 parent 95f4f1d commit 5dd276f
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
# from api_keys import mysql_user_project2
# from api_keys import mysql_pass_project2

mysql_hostname = os.environ['MYSQL_HOSTNAME']
print(mysql_hostname)
mysql_port = os.environ['MYSQL_PORT']
print(mysql_port)
mysql_user_project2 = os.environ['MYSQL_USERNAME']
mysql_pass_project2 = os.environ['MYSQL_PASSWORD']
# mysql_hostname = os.environ['MYSQL_HOSTNAME']
# print(mysql_hostname)
# mysql_port = os.environ['MYSQL_PORT']
# print(mysql_port)
# mysql_user_project2 = os.environ['MYSQL_USERNAME']
# mysql_pass_project2 = os.environ['MYSQL_PASSWORD']



# Database name and database tables
Expand All @@ -24,12 +25,12 @@
table_airports = "airport_data"

# MySQL specific connection string
database_uri = f"""mysql+mysqlconnector://
{mysql_user_project2}:
{mysql_pass_project2}@
{mysql_hostname}:
{mysql_port}/
{database_name}"""
try:
database_uri = os.environ['DATABASE_URL']
except KeyboardInterrupt:
database_uri = f"mysql+mysqlconnector://{mysql_user_project2}:{mysql_pass_project2}@{mysql_hostname}:{mysql_port}/{database_name}"

print(database_uri)

# Create the engine to connect to the database
engine = create_engine(database_uri)
Expand Down

0 comments on commit 5dd276f

Please sign in to comment.