||3 weeks ago|
|static||3 weeks ago|
|templates||3 weeks ago|
|.gitignore||3 weeks ago|
|LICENSE||3 weeks ago|
|Pipfile||3 weeks ago|
|Pipfile.lock||3 weeks ago|
|README.md||3 weeks ago|
|contacts.json||3 weeks ago|
|contacts_other_content.json||3 weeks ago|
|helpers.py||3 weeks ago|
|routes.py||3 weeks ago|
|run||3 weeks ago|
Enjoy the HTMX examples rendered with Flask!
git clone cd /htmx-examples-with-flask pipenv install
- Open http://127.0.0.1:5000/
What is where
- html_examples.html links to all individual examples
- Each example has its own template in /templates, e.g. click_to_edit.html
- Each example has its own jinja partial(s) in /templates/partials. e.g. click_to_edit_contact_get.py
- All routes are in routes.py
- There's one main route by example, e.g.
@app.route("/examples/click-to-edit/") def get_click_to_edit():
- It is followed by additional routes, as the example requires, e.g.
@app.route( "/contact/<int:id>", methods=['GET']) def get_contact(id): @app.route( "/contact/<int:id>", methods=['PUT']) def put_contact(id):
Sample data is in contacts.json. There are simple routines to read and write to it. Not safe, not production ready, etc. If you think that using something production-like, e.g. a DB would make more sense for the examples please let me know. My thinking so far is that it will only clutter the examples codebase.
If the examples' implementation is not super-easy to install and figure out, please write me to tell me what makes it difficult.