Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marty331/fasthtmx
FastAPI-HTMX Demo Project
https://github.com/marty331/fasthtmx
fastapi hactoberfest hactoberfest-2021 hactoberfest2021 htmx prs-welcome
Last synced: 3 months ago
JSON representation
FastAPI-HTMX Demo Project
- Host: GitHub
- URL: https://github.com/marty331/fasthtmx
- Owner: marty331
- Created: 2021-10-13T02:34:37.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-01-15T16:41:39.000Z (10 months ago)
- Last Synced: 2024-05-20T21:24:15.336Z (6 months ago)
- Topics: fastapi, hactoberfest, hactoberfest-2021, hactoberfest2021, htmx, prs-welcome
- Language: CSS
- Homepage:
- Size: 1.34 MB
- Stars: 222
- Watchers: 5
- Forks: 31
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-htmx - fast-htmx - Fast-HTMX is a demo project of FastAPI an HTMX. The purpose of this project is to illustrate how to create a website with no JavaScript, using only HTML, CSS, and Python. (Examples by Back-end / Python-based (Django, FastAPI, Flask))
README
# Fast-HTMX
## Description
Fast-HTMX is a demo project of [FastAPI](https://fastapi.tiangolo.com) and [HTMX](https://htmx.org). The purpose of this project
is to illustrate how to create a website with no JavaScript, using only HTML, CSS, and
Python. HTMX is a plugin that allows this to be possible.## HTMX Attributes
The following HTMX attributes are used in this project:- hx-get
- hx-post
- hx-trigger
- hx-target
- hx-push-url
- hx-indicator
- hx-swap## Structure
db - Database setupmodels - Data models
schema - Pydantic models
services - Database services
static - Static files
templates - Contains files for each page and partials for all partial pages that are related to the main page of the directory which it is under.
viewmodels - View models for gathering data for pages and partials.
main.py - Main operational file for running FastAPI.
## How to run
- Create virtual environment
- Activate virtual environment
- Install requirements `pip3 install -r requirements.txt`
- Run project `python3 -m uvicorn main:app --reload`
### Using Docker
- Build image `docker build -t fast-htmx .`
- Create Database `touch sql_app.db`
- Run container `docker run -v $(pwd)/sql_app.db:/code/sql_app.db -d --name fast-htmx -p 8000:8000 fast-htmx`