Update main.py

If load_dotenv() is not called before importing modules that rely on environment variables defined in the .env file, those modules might not be able to access the environment variables correctly. This could lead to errors or unexpected behavior in your code.
This commit is contained in:
Khajaameen455@ 2024-02-23 14:31:15 +05:30 committed by GitHub
parent c0e084aa86
commit d20f402d89
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,13 +1,11 @@
# Load environment variables first
from dotenv import load_dotenv from dotenv import load_dotenv
load_dotenv()
from fastapi import FastAPI from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware from fastapi.middleware.cors import CORSMiddleware
from routes import screenshot, generate_code, home, evals from routes import screenshot, generate_code, home, evals
# Load environment variables first
load_dotenv()
app = FastAPI(openapi_url=None, docs_url=None, redoc_url=None) app = FastAPI(openapi_url=None, docs_url=None, redoc_url=None)
# Configure CORS settings # Configure CORS settings