Skip to content

Commit 769cb8f

Browse files
committed
restored azure stuff
1 parent 848425c commit 769cb8f

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

app.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,18 @@
1010
csrf = CSRFProtect(app)
1111

1212
# Loading config.development and environment variables from .env file.
13+
if 'WEBSITE_HOSTNAME' not in os.environ:
14+
# local development, where we'll use environment variables
15+
print("Loading config.development and environment variables from .env file.")
16+
app.config.from_object('azureproject.development')
17+
else:
18+
# production
19+
print("Loading config.production.")
20+
app.config.from_object('azureproject.production')
21+
1322
app.config.update(
14-
SQLALCHEMY_DATABASE_URI='postgresql+psycopg2://{dbuser}:{dbpass}@{dbhost}/{dbname}'.format(
15-
dbuser=os.environ['DBUSER'],
16-
dbpass=os.environ['DBPASS'],
17-
dbhost=os.environ['DBHOST'],
18-
dbname=os.environ['DBNAME']
19-
),
20-
SQLALCHEMY_TRACK_MODIFICATIONS=False,
23+
SQLALCHEMY_DATABASE_URI=app.config.get('DATABASE_URI'),
24+
SQLALCHEMY_TRACK_MODIFICATIONS=False,
2125
)
2226

2327
# Initialize the database connection

0 commit comments

Comments
 (0)