Created
February 5, 2022 18:15
-
-
Save anandtripathi5/8a136ef2788dcbf6bcf6943846c8768a to your computer and use it in GitHub Desktop.
Flask application with pydantic as configuration
This file contains hidden or 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 | |
from dotenv import load_dotenv | |
from config import settings | |
load_dotenv() # take environment variables from .env. | |
app = Flask(__name__) | |
@app.get("/") | |
async def hello_world(): | |
template = f''' | |
<p>Hello, {vars(settings)}!</p> | |
''' | |
return template | |
if __name__ == '__main__': | |
app.run(port=settings.port) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment