I have created Cosmos DB account with MongoDB driver and want to access it from flask server. Here is the simplest example I'm trying:
from flask import Flask
from pymongo import MongoClient
url = 'monbodb://<my_db_name>.documents.azure.com:10255/?ssl=true
username = '<my_db_name>'
password = '<my_password>'
client = MongoClient(url, username=username, password=password)
app = Flask(__name__)
@app.route('/ping', methods=['GET'])
def ping():
return 'pong!'
if __name__ == '__main__':
app.run()
I deploy it with git and at the end it says the deployment was successful. But really app has crashed because webpage is not accessible, saying "The page cannot be displayed because an internal server error has occurred.". I guess issue is with SSL, because removing '/?ssl=true' does allow access app webpage but it this case DB is not accessible! What is with issue and how can it be fixed?