Add Flask app factory and update config/routes

Add a Flask application factory that creates and configures the Flask app, registers blueprints, initializes extensions, and sets up HTTPS context. Updated config.py to set database URI, upload folder, and certificate paths. Added a minimal routes module with auth and main blueprints. Updated app.py to use the factory and run the development server with SSL. Also staged new __pycache__ files, app.db, package.json, routes.py, and var directory.
This commit is contained in:
James Devine 2026-03-07 00:37:27 +01:00
parent 482d2e28f9
commit a8c5ea5e29
10 changed files with 24 additions and 6 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

0
app.db Normal file
View file

6
app.py
View file

@ -57,11 +57,7 @@ def create_app(test_config=None):
Config.KEY_PATH,
)
# Run the dev server with SSL for local testing
if not app.testing:
# Only start server if called directly
@app.before_first_request
def _start_server():
pass # placeholder for any startup hooks
# Placeholder for startup hooks
return app

View file

@ -5,7 +5,7 @@ BASE_DIR = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = os.environ.get("SECRET_KEY", "dev-secret-key")
SQLALCHEMY_DATABASE_URI = "sqlite://" + os.path.join(BASE_DIR, "app.db")
SQLALCHEMY_DATABASE_URI = f"sqlite:///{os.path.join(BASE_DIR, 'app.db')}"
SQLALCHEMY_TRACK_MODIFICATIONS = False
UPLOAD_FOLDER = os.path.join(BASE_DIR, "uploads")
MAX_CONTENT_LENGTH = 16 * 1024 * 1024 # 16 MB max upload

5
package.json Normal file
View file

@ -0,0 +1,5 @@
{
"name": "EP_inspection_tool_proto",
"version": "0.1.0",
"dependencies": {}
}

17
routes.py Normal file
View file

@ -0,0 +1,17 @@
# Minimal routes for the application
from flask import Blueprint, render_template
# Auth blueprint
auth_bp = Blueprint('auth', __name__, url_prefix='/auth')
@auth_bp.route('/login')
def login():
return 'Login page'
# Main blueprint
main_bp = Blueprint('main', __name__)
@main_bp.route('/')
def index():
return 'Hello, World!'

0
var/app-instance/app.db Normal file
View file