-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.py
More file actions
33 lines (23 loc) · 884 Bytes
/
settings.py
File metadata and controls
33 lines (23 loc) · 884 Bytes
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
import os
from datetime import timedelta
from dotenv import load_dotenv
# Load environment variables from `.env` file
load_dotenv()
# Pagination configuration
DEFAULT_PAGE_SIZE = 10
class Config:
# Database configuration
MYSQL_HOST = os.getenv("DB_HOST", "host.docker.internal")
MYSQL_USER = os.getenv("DB_USERNAME", "root")
MYSQL_PASSWORD = os.getenv("DB_PASSWORD", "myrootpassword")
MYSQL_DB = os.getenv("DB_NAME", "smartcooking")
MYSQL_CURSORCLASS = "DictCursor"
# JWT configuration
JWT_SECRET_KEY = os.getenv("JWT_SECRET_KEY")
JWT_ACCESS_TOKEN_EXPIRY = timedelta(hours=1)
JWT_REFRESH_TOKEN_EXPIRY = timedelta(days=30)
# Image upload folder
IMAGES_FOLDER = os.path.join(os.getcwd(), "pictures")
MAX_CONTENT_LENGTH = 1024 * 1024 # 1 MB
if not os.path.exists(Config.IMAGES_FOLDER):
os.makedirs(Config.IMAGES_FOLDER)