Spaces:
Sleeping
Sleeping
File size: 701 Bytes
d18cfcb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# app/__init__.py
from flask_cors import CORS
import os
from flask import Flask
from flask_pymongo import PyMongo
from dotenv import load_dotenv
import cloudinary
import cloudinary.uploader
# Load env variables
load_dotenv()
app = Flask(__name__)
# Enable CORS
CORS(
app,
origins=[
"https://moodify-murex.vercel.app",
],
supports_credentials=True
)
# Config from env
app.config["SECRET_KEY"] = os.getenv("SECRET_KEY")
app.config["MONGO_URI"] = os.getenv("MONGO_URI")
# MongoDB connection
mongodb_client = PyMongo(app)
db = mongodb_client.db
# Cloudinary config (reads CLOUDINARY_URL directly from .env)
cloudinary.config(
secure=True
)
# Attach routes
import routes
|