Created
July 11, 2020 02:23
-
-
Save kunxin-chor/d9e8cba071cad1615aadb43e3e515ba2 to your computer and use it in GitHub Desktop.
Flask Template with pymongo and load_dotenv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, render_template, request, redirect, url_for | |
import os | |
import pymongo | |
from dotenv import load_dotenv | |
load_dotenv() | |
app = Flask(__name__) | |
MONGO_URI = os.environ.get('MONGO_URI') | |
CLOUD_NAME = os.environ.get("CLOUD_NAME") | |
# "magic code" -- boilerplate | |
if __name__ == '__main__': | |
app.run(host=os.environ.get('IP'), | |
port=int(os.environ.get('PORT')), | |
debug=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment