Adding app factory and settings
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
4dd7672ba1
commit
4e27d3b407
@ -0,0 +1 @@
|
|||||||
|
SECRET_KEY=6755ecb085f9c8d2b7da9f6fd3d9b3590758a1602f1a98724abbe204ff525153
|
@ -0,0 +1,15 @@
|
|||||||
|
from flask import Flask
|
||||||
|
|
||||||
|
from .config import ContactSettings
|
||||||
|
|
||||||
|
|
||||||
|
def create_app(config: ContactSettings = None):
|
||||||
|
app = Flask("htmx_contact")
|
||||||
|
|
||||||
|
app.config.from_object(config if config else ContactSettings())
|
||||||
|
|
||||||
|
from . import main
|
||||||
|
|
||||||
|
app.register_blueprint(main.bp)
|
||||||
|
|
||||||
|
return app
|
@ -0,0 +1,5 @@
|
|||||||
|
from pydantic_settings import BaseSettings
|
||||||
|
|
||||||
|
|
||||||
|
class ContactSettings(BaseSettings):
|
||||||
|
SECRET_KEY: bytes
|
@ -1,15 +1,15 @@
|
|||||||
from flask import Flask
|
from flask import Blueprint
|
||||||
from flask import redirect
|
from flask import redirect
|
||||||
from flask import render_template
|
from flask import render_template
|
||||||
|
|
||||||
app = Flask("htmx_contact")
|
bp = Blueprint("main", __name__, url_prefix="/")
|
||||||
|
|
||||||
|
|
||||||
@app.route("/", methods=["GET"])
|
@bp.route("/", methods=["GET"])
|
||||||
def index():
|
def index():
|
||||||
return redirect("/contacts")
|
return redirect("/contacts")
|
||||||
|
|
||||||
|
|
||||||
@app.route("/contacts", methods=["GET"])
|
@bp.route("/contacts", methods=["GET"])
|
||||||
def contacts():
|
def contacts():
|
||||||
return render_template("contacts.html", message="Hello HTMX")
|
return render_template("contacts.html", message="Hello HTMX")
|
@ -1,2 +1,4 @@
|
|||||||
flask
|
flask
|
||||||
|
pydantic
|
||||||
|
pydantic-settings
|
||||||
sqlalchemy
|
sqlalchemy
|
||||||
|
Loading…
Reference in New Issue