Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,5 @@ secrets.*
.idea/

# Logs
logs/
*.log
14 changes: 14 additions & 0 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@
from app.models import Base
import os
import json
import logging

# Handle the logging
log_directory = "logs"
if not os.path.exists(log_directory):
os.makedirs(log_directory)
log_file_path = os.path.join(log_directory, "app.log")

logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s',
handlers=[logging.StreamHandler(), logging.FileHandler('logs/app.log')]
)
logging.info("FastAPI application started.")

# Create database tables only if not in test environment
if not os.getenv("TESTING"):
Expand Down
3 changes: 2 additions & 1 deletion env.example
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ AWS_S3_BUCKET=aixiv-papers
# ========================================
SECRET_KEY=your_secret_key_here
DEBUG=True
ALLOWED_ORIGINS=http://localhost:3000,http://127.0.0.1:3000
ALLOWED_ORIGINS=http://localhost:3000,http://127.0.0.1:3000
AUTH_TOKEN=your-auth-token-here