-
Notifications
You must be signed in to change notification settings - Fork 1
Azure Deployment
In this page we shall describe how you're going to deploy the website into the web. The instructions consist of two sections:
- Go to "database.py" and comment the following line (in initialize() function):
client = pymongo.MongoClient(Database.URI)
- Go to "database.py" and uncomment the following lines (in initialize() function):
# client = pymongo.MongoClient(os.getenv("CUSTOMCONNSTR_MONGOURL"))
# Database.DATABASE.authenticate(name=os.getenv("CUSTOMCONNSTR_MONGO_USERNAME"),password=os.getenv("CUSTOMCONNSTR_MONGO_PASSWORD"))
-
Login into your Microsoft account in azure portal:
https://portal.azure.com -
Press on the button "Create a resource"
-
In the search line search for "Azure Cosmos DB" and when you find the resource press on "create"
-
In the ID field enter a name of your liking
-
In the API field choose MongoDB
-
In the Subscription field choose your subscription
-
In the Location field choose whatever you want (recommended: West EU)
-
In the resource group field create a new one and give it a name of your liking
-
Don't touch other options and press Create
-
Go to your created CosmosDB database resource under "Azure CosmosDB"
-
Scroll down to "Connection String" and copy and save the following three values:
- USERNAME
- PRIMARY PASSWORD
- PRIMARY CONNECTION STRING
-
Login into your Microsoft account in azure portal:
https://portal.azure.com -
Press on the button "Create a resource"
-
In the search line search for "Web App" and when you find the resource press on "create"
-
In the name field choose the name of your app (note: this server as the hostname of your app, i.e. if you choose the name "HelloWorld", the url of your web app shall be HelloWorld.azurewebsites.net)
-
In the resource group field create a new one and give it a name of your liking
-
Don't touch other options and press Create
-
Go to your created web app resource under "App Services"
-
Scroll down until you get to "Application Settings" and press it
-
In "Python Version" please choose 3.4
-
Add three connection strings (all three should be selected to be "Custom"):
- MONGOURL with the value of PRIMARY CONNECTION STRING you copied earlier
- MONGO_USERNAME with the value of USERNAME you copied earlier
- MONGO_PASSWORD with the value of PRIMARY PASSWORD you copied earlier
-
Go to "Deployment option"
-
Press on "Choose Source"
-
Choose "GitHub"
-
Connect into your GitHub account (if prompted to)
-
Choose the project (the one you cloned earlier)
-
Press OK