{"id":19692986,"url":"https://github.com/magnetrwn/flask-htmx-docker","last_synced_at":"2026-04-09T18:49:22.947Z","repository":{"id":196191560,"uuid":"694777392","full_name":"magnetrwn/flask-htmx-docker","owner":"magnetrwn","description":"Prebuilt Flask template, with HTMX front-end interaction.","archived":false,"fork":false,"pushed_at":"2023-11-17T23:04:41.000Z","size":37,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-10T09:10:42.624Z","etag":null,"topics":["docker","docker-compose","flask","htmx","learn","sqlite"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/magnetrwn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-09-21T17:09:03.000Z","updated_at":"2024-01-13T15:44:44.000Z","dependencies_parsed_at":"2023-09-22T20:27:18.416Z","dependency_job_id":null,"html_url":"https://github.com/magnetrwn/flask-htmx-docker","commit_stats":null,"previous_names":["magnetrwn/flask-htmx-docker"],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magnetrwn%2Fflask-htmx-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magnetrwn%2Fflask-htmx-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magnetrwn%2Fflask-htmx-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magnetrwn%2Fflask-htmx-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/magnetrwn","download_url":"https://codeload.github.com/magnetrwn/flask-htmx-docker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241001897,"owners_count":19892072,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-compose","flask","htmx","learn","sqlite"],"created_at":"2024-11-11T19:14:57.213Z","updated_at":"2026-04-09T18:49:17.893Z","avatar_url":"https://github.com/magnetrwn.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flask + HTMx + Docker\n\n**A little base project to get up to speed with web development and deployment using Flask, HTMx and shell, with a simple model, view/blueprint, and template available.**\n\n## Quick Start\n\nYou can:\n+ Clone this template repo: `git clone https://github.com/magnetrwn/flask-htmx-docker`.\n+ Run the clone with: `docker-compose build \u0026\u0026 docker-compose up`.\n+ Or just get the image with: `docker pull ghcr.io/magnetrwn/flask-htmx-docker:nightly`\n\nYou can also run the clone locally by using the scripts in `scripts/`. Use `scripts/run-app-gunicorn.sh debug` to run a local Gunicorn instance, but make sure you have run `scripts/setup-python-env.sh` at least once.\n\n## What is this?\n\nI wanted to expand a Flask/HTMx project I had found [here](https://codecapsules.io/docs/tutorials/build-flask-htmx-app/#building-the-htmx-frontend), so I separated views, models and templates further, added db and log folders, and setup Docker for deployment.\n\nNow, this structure can be repurposed for other simple Flask/HTMx web applications!\n\n## Requirements\n\nCurrently, as you can see in `requirements.txt`, the image installs the following using pip3 in a persistent virtual environment `appenv`:\n```\nflask\nflask-sqlalchemy\ngunicorn\n```\n\n## Project \u0026 Image Setup\n\nThe `db/`, `log/` and `appenv/` folders are persistent, and are represented as volumes `/db`, `/log` and `/flask-htmx/appenv` in deployment.\n\n**Note:** When using the Docker image, make sure to replace the default contents of the following directories:\n\n```sh\n# Replace these with your own:\n/flask-htmx/app/models/\n/flask-htmx/app/templates/\n/flask-htmx/app/views/\n\n# Include your new models and views here:\n/flask-htmx/app/__init__.py\n```\n\nYou can use the defaults to debug the image before starting Flask development.\n\nTo replace the contents of the image, you should use this Dockerfile syntax:\n\n```dockerfile\nFROM ghcr.io/magnetrwn/flask-htmx-docker:nightly\n\n# Replace the template app entirely\nCOPY my-app /flask-htmx/app\n# Make sure to have variable 'app' available with Flask in 'app/__init__.py',\n# as well as importing all models and views (check the file for clarity).\n# Why? check note below.\n```\n\n**Note:** When starting Gunicorn, it searches for variable `app` inside of module `app`: you can find it in `app/__init__.py`. This is why it also contains the blueprint registration logic, although this approach is only appropriate for compact web designs, so you should further separate `__init__.py` moving on.\n\nThe default database used by this template is SQLite, and it is embedded for lightweight database usage, but you should integrate with larger database systems for heavier applications, since SQLite is not good for parallel performance: it will **mutex one client at a time** on the whole database file!\n\n## License \u0026 Contrib\n\nLicensed under MIT. Feel free to contribute if you want to!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagnetrwn%2Fflask-htmx-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagnetrwn%2Fflask-htmx-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagnetrwn%2Fflask-htmx-docker/lists"}