This commit is contained in:
Cody Cook 2025-06-15 21:20:30 -07:00
commit 095bf52a2f
29 changed files with 2494 additions and 758 deletions

39
main.py
View file

@ -3,22 +3,47 @@
Podcastrr - A podcast management application similar to Sonarr but for podcasts.
"""
import os
import logging
from dotenv import load_dotenv
from app.web.app import create_app
from application import create_app
from app.models.database import db
# Load environment variables from .env file
load_dotenv()
# Create Flask application instance
app = create_app()
# Set up logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)
def main():
"""
Main entry point for the application.
"""
# Create the Flask app
app = create_app()
# Create database tables if they don't exist
with app.app_context():
db.create_all()
print("Database tables created successfully!")
if __name__ == "__main__":
# Get port from environment variable or use default
port = int(os.environ.get("PORT", 5000))
debug = os.environ.get("FLASK_ENV") == "development"
print(f"Starting Podcastrr on port {port}")
print(f"Debug mode: {debug}")
# Run the application
app.run(
host="0.0.0.0",
port=port,
debug=os.environ.get("FLASK_ENV") == "development"
)
debug=debug
)
if __name__ == '__main__':
main()