I am creating this post from a desktop app that I created in 3 lines.
Published
All published posts
sqlalchemy server_defaults end up as defaults in the database when new values are inserted.
A feature of jinja that I just discovered is including sub templates. Here is an example from the docs.
{% include 'header.html' %} Body goes here. {% include 'footer.html' %}
And inside of my thoughts project I used it to render posts.
<ul id='posts'> {% for post in posts.__root__ %} {% include 'post_item.html' %} {% endfor %} </ul>
note that post_item.html automatically inherits the post variable.
A guide to add Jinja2Templates to fastapi.
A complete reference of all of the htmx swapping methods.
I am trying to use htmx on a new fastapi site for my thoughts, and have been hitting this error.
Mixed Content: The page at 'https://front.mydomain.com/#/clients/1' was loaded over HTTPS, but requested an insecure resource 'http://back.mydomain/jobs/?_end=25&_order=DESC&_sort=id&_start=0&client_id=1'. This request has been blocked; the content must be served over HTTPS.
What is happening #
I have an htmx component that gets the current users name, but if they are not logged in the backend redirects to a login form.
<div hx-get='/users/me' hx-trigger='load'> get me </div>
But for some reason when the front end gets this redirect, it tries to do it through http,...
...
On void linux. Under `/etc/containers/` there is a file called `registries.conf`. It is complemented by `man 5 containers-registries.conf`. Change (for me lines 11-12) which say [registries.search] registries = [] to
[registries.search] registries = ['docker.io']
Without the above you won’t be able to use basic Various documentation (redhat blog entries, ... (drawn from https://www.projectatomic.io/blog/2018/05/podman-tls/)
podman functions. You might get errors like:man podman pages) say that dockerhub is a default, but without this step it’s clearly not.Good luck. Feel free to use the comment box below if you have a github account.
Using templates with htmx requires the client-side-templates extension, and the template engine to be loaded in a <script> tag.
example htmx using templates.
Mounting static files in fastapi.
Love the poling example with hx-trigger=‘every 1s’.
Here is a snippet provided by @tiangolo to store the users jwt inside of a session cookie in fatapi. This was written in feb 12, 2020 and admits that this is not a well documented part of fastapi.
It’s already in place. More or less like the rest of the security tools. And it’s compatible with the rest of the parts, integrated with OpenAPI (as possible), but probably most importantly, with dependencies.
It’s just not properly documented yet. 😞
But still, it works 🚀 e.g.
Harlequin is a pretty sweet example of what textual can be used to create. Its a terminal based sql ide for DuckDB.
To persist data in duckdb you need to first make a connection to a duck db database.
con = duckdb.connect('file.db')
Then work off of the connection con rather than duckdb.
duckdb can just query any pandas dataframe that is in memory.
I tried running it against a list of objects and got this error. Great error message that gives me supported types right in the message.
pytest-subtests is a package to register multiple subtests within a similar test function.
A nice codepen reference for dark forms. I am using it for my thoughts chrome extension.
![[None]]
When setting up a new machine, vm, docker image you might be installing command line tools from places like pip. They will often put executables in your ~/.local/bin directory, but by default your shell is not looking in that directory for commands.
WARNING: The script dotenv is installed in '/home/falcon/.local/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
To solve this you need to add that directory to your $PATH.
export PATH=$PATH:~/.local/bin
To make this change permanant add this line to your shell’s init script, which is likely something like ~/.bashrc or ~/.zshrc.
Very inspiring textual project to check out how they set up the ui. Their intro video has a pretty epic dev experience.
wsrepl is an epic websocket repl built in python on the textual framework.
When fetching pydantic models from the database with sqlmodel, and you cannot select your item by id, you probably need to use a where clause. This is the sqlmodel way of doing it.
Here is a snippet of how I am using sqlmodel select and where to find a post by link in my thoughts database.