Hey look! A legit blog post that made it out of the drafts!
@webology ‘s weekly Office Hours is great fodder for potential blog posts. Yesterday Jeff asked how everyone handles their Django project’s static files. I decided to write about my approach, which takes inspiration from how some JS frameworks approach it.
“How I organize staticfiles in my Django projects”
@programmylife highly recommend using something like a Justfile to collect these common commands - saves typing, mental space, and easier to onboard others
@webology@programmylife If there was a way to toggle the echo via a setting in the Justfile or an environment variable I would be all over that. After onboarding some noobs who were unfamiliar with just, Docker, and Django this year to our codebases, I found the echoing helped them demystify what was going on under the hood. As for me, I tend to like seeing the final command as well as a sanity check.
Spent the morning playing with HTMX and Alpine.js to replace the React component currently handling search in a work app. What a breath of fresh air! One view with template partials and it feels so much snappier than before. I even enabled a Ctrl K shortcut for focusing the search input as a treat, even though my users will undoubtedly never use that feature.
After suffering through migrating this old ColdFusion app to DRF + React — because that’s what the agency we were using recommended — and slowly realizing that it’s way overkill for the app, it’s been a relief to slowly start to simplify it.
👀 So it's a rare Saturday when I'm working because I shifted my week to take a Monday off, and I'm getting logged out of the Django Admin (localhost + Django 5.0.4) every ~5 seconds.
My console shows:
> django.security.SuspiciousSession WARNING Session data corrupted
This issue seemed to go away after I re-ran collectstatic to fix a few broken images. (It already gets ran at least twice).
🤔 I am not sure if this is a new Django bug or if anyone else is seeing this?
How sre people addressing Celery queue visibility these days? Specifically length of queues, time spent processing, etc? I’ve heard recommendations for flower many times but we’ve had issues securing it in a prod environment. Any tips are super appreciated
Crunchy and Tailscale has been working really well for me, once we got everything set up. Allows me to keep my DB off the public internet and still connect to it via my Fly.io apps.
@webology I wonder if they have that config because it’s written in TS? I was getting around it by using sys.executable and it seemed to be working — I am able to import django and get the version from the test project I was using. But when I go to call django.setup() that’s when it goes belly up.
@webology I dunno, maybe at first when I was running the lsp server over stdin, but I switched to tcp with the server running directly in the project dir which should have access to everything. I know I’m holding something wrong here but it’s hard to see what.
@webology on the bright side I’ve gotten a lot more familiar with the LSP spec and am pretty sure once I get over this hump getting a useful prototype should come fairly quickly
@webology what I can’t figure out is it doesn’t crash or error or anything else with a useful log or traceback. It just.. freezes. I should probably graduate from the print debugging and actually use a real debugger 😂
Confusingly, if I use separate terminals (I normally use tmux windows) the debug messages I put after django.setup() to send from the lsp server to the client actually show up. The setup call still hangs, but it’s at least failing in a different way now. Progress!