3,216 karma · joined January 2, 2009
https://davepeck.org/about/
SGI's hardware was cutting-edge and exotic. IRIX was killer (sorry Solaris). Cray was a subdivision. My coworkers used emacs, too. They put an O2 on my desk!
The dream didn't last long. Major layoffs hit just a few months after I started full time. I wrote about the experience here: https://davepeck.org/2009/02/11/the-luckiest-bad-luck/
Some of the paper cuts described include:
- Inexplicable interaction between the data layer and a hosting service's environment variable
- Migrations that don't work reliably
- Cron jobs that don't work reliably
- Inexplicable caching behavior for serverless functions, requiring an obtuse workaround
- An auth library that makes it hard to... get the ID of the logged-in user, apparently
I dunno, I suppose I'm happy to stick with boring old tech.
Out of curiosity, when you're building a mostly static site that might want occasional islands of interactivity, what do you reach for instead?
As an aside: there are days when I wish I could avoid using the Astro component model entirely, do everything in Preact (or whatever), and still use the `client:*` directives when appropriate. I realize this is easier said than done and also probably not a reasonable thing for Astro itself to try and target -- but moving between Astro components and framework components always has just enough friction that it's something I think I'd enjoy using.
The downvotes here seem to be catching bullshit quite well!
The underlying `swtl` library is itself pretty interesting.
Note the use of `delayed(...)` in the blog's example code: a promise in a tagged template.
SWTL's `html` allows for this (I think the blog's example follows the simple case here https://github.com/thepassle/swtl/blob/main/html.js#L23). And SWTL's `render` method races the promises (https://github.com/thepassle/swtl/blob/main/render.js#L120) outward.
You can make a little tic-tac-toe game that runs in your browser using just React -- no need for Django, provided you don't want to save the state of the game to a database or something.
If I wanted to start today, I'd make sure I had Node 20.x installed, and then run `npm create vite@latest`. I'd name my project `tictac`, then select both `React` and `TypeScript`. I'd follow the instructions I get and visit the running React app in my browser at http://localhost:5173/.
From there, you can edit `src/App.tsx`. Make a tiny change, save it, and your browser will update immediately. I'd probably build my whole tic tac toe game right there in that single file.
TypeScript is optional but it's useful to learn and won't add too much complexity for this particular project (you can mostly ignore it if you like).
Once you have some basic comfort with these tools, the next question will be: okay, how can you make the code you just wrote talk to a Django server? A simple answer might be: have your code call out to the Django server by making a fetch() call. You'll have to figure out where, exactly, fetch() calls belong in React-using code. And you’ll want to have your Django server return some JSON (from a view) that your javascript code does something with. For this to work on your development machine, you'll run both the Vite server and the Django server at the same time. (npm run dev; python manage.py runserver).
A really tiny Django view should do just fine to start -- your goal is just to make sure the data sent by the Django server is received by your javascript code. After that, you can start to get fancy. You do not need Django Rest Framework, Ninja, or any other extension to Django on day one -- plain old Django is quite capable of sending and receiving JSON data. (Someday later, you might consider one of those add-ons, but I'd stick with the basics first.)
I wish I had a hard and fast rule for the choice, but it's something like:
- Litestar if I know with certainty (a) the thing I'm building is and always will be a tiny service and (b) I probably won't have to evolve the backing data schema much. Wrap an ML model? Litestar. Have a small database I want to expose via API, read-mostly? Litestar.
- Django if I know (a) I'm going to be building on this over a longer timeframe, (b) I have complex user/group auth needs, (c) my data schema will likely go through substantial evolution, or (d) I will need an admin UI in the early goings, either for the managing team or for customer support.
I have plenty of SQLAlchemy+Alembic+Litestar backends but I vastly prefer the creature comforts of Django's ORM + migrations; it hits that 80% sweet spot so very well. SQLalchemy is both raw power and, often, far too much friction.
I used to choose between Django and Flask, but Litestar -- while still young -- seems to capture most of the key things I liked about core Flask but in a more modern package. (Maybe Quart, aka async Flask, will ultimately win the day; not sure.)
It's not targeted at the use case, but I wonder if Datasette will replace my need for the Django admin UI at least in some limited set of cases.
These days, most of my front-ends are React+Typescript+Vite.
(FWIW I personally avoid FastAPI entirely. I appreciate the impact it had getting the python community to think about (a) async (b) proper use of type hints in the web context and (c) the need for OpenAPI support, etc. but there are a lot of footguns and so many issues still opened that its (amazing, lovely) single maintainer probably won't get to. SQLModel -- aka the merging of Pydantic + SQLAlchemy ORM models -- is an even bigger trap, IMO.)
(I gather T&R recently changed ownership so I don't really know what its current status is or whether its fried chicken is precisely as legendary as this 90s kid remembers.)
(I can imagine recommendations that benefit incumbents by, for instance, placing such high burden on government adoption of open weight models that OpenAI is a much more attractive purchase. But that’s not the same as what you’re talking about.)
I dunno, the EO seems pretty easy to read. Am I missing something in the text?
https://www.whitehouse.gov/briefing-room/presidential-action...
This feels like an under-appreciated insight. There are lots of valuable (and in some cases previously difficult, expensive, or impossible) linguistic manipulations that fall under this lower-risk end of spectrum.
Amazon famously built the company with OBIDOS, a monolith; these days, backend microservices abound — as do what we’re calling here microfrontends, although my understanding is at AMZN they are granular not just to market-specific domains or route prefixes, but sometimes also to pre-defined sections of a final rendered page. Would love to hear from AMZN engineers that work on such things.
When using Pyright in large Django projects, it's helpful to add explicit type annotations in a number of places (like reverse relations in Models) but I've found this tends to improve the clarity of the resulting code anyway.
"STRONG TYPING IS SO 90s!"
That missive stayed on the board for over a year. I still think about it from time to time and remember that the tech world's pendulum is always in motion.
Today? I adore TypeScript and I'm pretty excited about the PEP 695 QOL improvements to type annotations in Python 3.12. Where types and tools are concerned, we're in a much better place today than when Nirvana was still the next big thing.
But I won't be surprised at all if in another decade I see "STRONG TYPING IS SO 20s" marked on some corporate whiteboard in Redmond. :-)
The blog post might be worth a gander.
Here in Seattle, Rover (a $1B+ market cap company) also uses Django extensively. As do lots of interesting local startups.
Simon Willison calls it the “baked data pattern” — where a read-only copy of your data is checked into your repo alongside your code. [1]
(And, just to tie the threads together, that’s the same Simon who wrote the OP we’re all commenting on, and who is also the co-creator of Django and more recently of the very handy Datasette!)
One catch: I like to deploy static sites to GitHub Pages. It turns out the Django ecosystem has an answer for that in the form of Django Distill [1]. Distill adds a new management command that generates static content by repeatedly invoking your views.
I've used Distill to build quite a few static sites. It's great to be able to deploy to Pages but use Django's admin UI locally. Typically, for these sites, I check in my 'production' SQLite database directly to my git repo.
(Combine this pattern with GitHub actions and you can do a lot with a little. For instance, here's a toy I built to summarize upcoming Seattle city council meetings [2].)
[1] https://github.com/meeb/django-distill
[2] https://scc.frontseat.org/ -- source at https://github.com/front-seat/engage
(Secondarily, I'm guessing some of the `type` attributes should probably be "atom" rather than "rss"?)
[0] https://github.com/outcoldman/hackernews-personal-blogs/blob...
Out of curiosity, how _does_ fly.io see itself in relation to Heroku?