import os from datetime import datetime from flask import Flask from app import create_app, db from app.models import Category, Item, ContactInfo app = create_app() @app.shell_context_processor def make_shell_context(): return {'db': db, 'Category': Category, 'Item': Item, 'ContactInfo': ContactInfo} @app.context_processor def inject_now(): return {'now': datetime.utcnow()} # Create upload folder when app starts instead of using before_first_request with app.app_context(): os.makedirs(app.config['UPLOAD_FOLDER'], exist_ok=True) if __name__ == '__main__': app.run(debug=True)