Live data from Hacker News

Unicorn – A full-stack web framework for Django

django-unicorn.com

21–30 of 92 posts

Re: Unicorn – A full-stack web framework for Django

#23
Great to see the growing effort to explore all the fields left uncultivated by the breathless SPA/angular/react/vue bandwagons of the past decade. It feels like a ratonal reallocation of tasks to where they can be executed best.

Something that is nagging me though is the (still) rather incomplete take on client-side reactivity. Alpine.js is by-and-large addressing this in a pleasantly minimalistic way, but for this new take to become a defacto standard of lean and mean modern web development I feel there should be uniform semantics and integration that spans the different server-side stacks. This way code and knowledge would be reusable and not tied to a specific language/web platform.

Re: Unicorn – A full-stack web framework for Django

#24
post #10

How is it a "full-stack framework" when it's "for Django" that provides the backend service? Also on their own homepage they mention "Using other frontend frameworks with Django", so I'll conclude it is in fact a frontend framework for Django.

This is subjective and in part marketing but given that it is installed with

  pip install django-unicorn
and used with

  from django_unicorn.components import UnicornView
like any other python module used in a Django app, I'd say that it brings the full stack inside Django, much like its counterparts for Laravel, Phoenix and Rails. What was only backend plus server side generated pages is also Javascript now, written inside the backend without even having to know Javascript.

Re: Unicorn – A full-stack web framework for Django

#25
post #19

Earlier quoted context omitted.

Batteries included means the stuff you need for most uses is already included. The fact that there are many possible add ins to solve this doesn't address the fact that Django does not include core functionality for web applications.

You mentioned running nodejs + typescript over extensive frameworks like django now. Curious if you chose to write your own framework or are you using something from nodejs space to do "batteries included" thing for you? Asking because I've had some experience with nest.js and even though it's fun it often feels hackish and a bit messy even when solving standard issues like authorization that's not a simple app wide…

I don't really know what is different.

I can say that nodejs and TypeScript and pure SQL is so simple and straightforward that I seem to need almost nothing in terms of "framework". I just write endpoints with a query behind them.

On reflection I spent alot of development time hacking around in Django models/forms and the ORM and really almost none of that is needed if you just write straight SQL with Postgres. It's just unnecessary complexity - once you cut all that guff out then things start to become REALLY simple. Request/auth/query/response.

I put auth into a separate web application which gets called by Caddy (or you coudl use Nginx) as an auth subrequest. This makes auth extremely easy, and gives a very powerful decoupling and separation of concerns.

For many years I have thought, finally, that's the last time I need to write a user signup/forgot password/signin flow, but every project still seems to need it written, so I do that myself.

This approach of super simple, just talking to Postgres also would work well with Python but I have come to really like TypeScript more than Python. The latest Python projects I wrote were pretty much Starlette with asynpg talking to Postgres and no ORM or other fluff - that's a pretty nice combination, and asyncpg is the fastest Postgres driver for Python by a country mile which is also nice.

If I wanted RBAC then I would intercept all my SQL queries and wrap them in Postgres RBAC environment variables that implement the Postgres constraints. I've done this before with Django, it worked pretty well, but I think it would be nicer and cleaner in a system without ORM or database abstraction of any form.

Re: Unicorn – A full-stack web framework for Django

#27

I've done extensive development with Flask, Bottle, Django, Falcon, Django Rest Framework, Starlette, Sanic and FastAPI over about 13 years or so. These days I prefer to build my back end applications with nodejs, TypeScript and plain SQL (no ORM) talking to Postgres. I like Django but it pissed me off no end that it's called "batteries included", except that the very first thing you need to do with any Django projec…

> I like Django but it pissed me off no end that it's called "batteries included"

The fact that the Django project and you have different preferences and consider different things essential is not a failure on their end. The fact that this "pisses you off" seems to indicate that you could channel your passion into more productive paths.

Re: Unicorn – A full-stack web framework for Django

#29
Django was a "batteries included" framework about 10 years ago. But the core team had very strong opinions about javascript, saying that picking a javascript framework should NOT be part of those batteries. Time has passed, and javascript is now part of every single website or app we build. Django still doesn't give any help to developers that wants to build a modern site.

My opinion: They should go the Phoenix Live View-route: adding a small websocket js layer, that permits reactivity while deferring as much logic to the backend as possible.

Re: Unicorn – A full-stack web framework for Django

#30
post #4

I wondered how Unicorn compared to htmx. They're giving an answer on their website: htmx and alpine.js are great libraries to provide interactivity to your HTML. Both of those libraries are generalized front-end framework that you could use with any server-side framework (or just regular HTML). They are both well-supported, battle-tested, and answers to how they work are probably Google-able (or on Stackoverflow). Un…

I wouldn’t consider htmx “battle tested”.
Post reply on HN