diff --git a/templates/flask/.env.example b/templates/flask/.env.example new file mode 100644 index 0000000..b22cfcc --- /dev/null +++ b/templates/flask/.env.example @@ -0,0 +1,2 @@ +SECRET_KEY=your-secret-key +# test comment 4 diff --git a/templates/flask/README.md b/templates/flask/README.md new file mode 100644 index 0000000..8464b14 --- /dev/null +++ b/templates/flask/README.md @@ -0,0 +1,10 @@ +# Flask Project Template + +A clean and modular Flask starter template using the application factory pattern and blueprints. + +## Setup + +```bash +python -m venv venv +source venv/bin/activate # Windows: venv\Scripts\activate +pip install -r requirements.txt diff --git a/templates/flask/app/__init__.py b/templates/flask/app/__init__.py new file mode 100644 index 0000000..1af2835 --- /dev/null +++ b/templates/flask/app/__init__.py @@ -0,0 +1,11 @@ +from flask import Flask +from .config import Config + +def create_app(): + app = Flask(__name__) + app.config.from_object(Config) + + from .routes import main + app.register_blueprint(main) + + return app diff --git a/templates/flask/app/config.py b/templates/flask/app/config.py new file mode 100644 index 0000000..964d7b3 --- /dev/null +++ b/templates/flask/app/config.py @@ -0,0 +1,4 @@ +import os + +class Config: + SECRET_KEY = os.getenv("SECRET_KEY", "dev") diff --git a/templates/flask/app/routes.py b/templates/flask/app/routes.py new file mode 100644 index 0000000..05077ba --- /dev/null +++ b/templates/flask/app/routes.py @@ -0,0 +1,7 @@ +from flask import Blueprint, jsonify + +main = Blueprint("main", __name__) + +@main.route("/") +def home(): + return jsonify({"message": "Flask template is running"}) diff --git a/templates/flask/requirements.txt b/templates/flask/requirements.txt new file mode 100644 index 0000000..f34604e --- /dev/null +++ b/templates/flask/requirements.txt @@ -0,0 +1,2 @@ +flask +python-dotenv diff --git a/templates/flask/run.py b/templates/flask/run.py new file mode 100644 index 0000000..488dae9 --- /dev/null +++ b/templates/flask/run.py @@ -0,0 +1,6 @@ +from app import create_app + +app = create_app() + +if __name__ == "__main__": + app.run(debug=True)