Live data from Hacker News

Unicorn – A full-stack web framework for Django

django-unicorn.com

71–80 of 92 posts

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

#71
post #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 in…

As in "alternative views for Django"?

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

#72
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”.

Aside:

htmx is a very small and very predictable library. The underlying pattern is well established among many libraries and probably countless similar implementations.

I have implemented something like htmx several times before htmx came out, and I assume many others have too. I just didn't take the time to extract a clean, generalized and comprehensive library.

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

#73

React aside… hooks, classes redux fatigue whatever- JSX is beautiful and any other framework that builds this quasi irb+mustache+html-like-markup is taking 2 steps back. I would like to see JSX survive the framework wars of 2024-2025

I think main issue is that react is easy to integrate with node, next etc. But python, php (laravel) etc. cant just run react-dom on the server. However would be interesting to see react-dom builders for php & python that would allow you to user react as a templating language in Laravel & Django.

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

#75
post #71
post #24

Earlier quoted context omitted.

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 in…

As in "alternative views for Django"?

They almost surely work together with Django standard views and templates. A Django view prepares the data for the template that renders the HTML page. Then some of that HTML talks with the Unicorn views declared in the attributes of its tags.

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

#76

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…

Re "batteries included" -- Often when you know what you want to accomplish, then 80% of the time there's an obvious straightforward way to get it done in the framework. The thing that gives me some anxiety about Django (and any other opinionated framework, I suppose), is that the other 20% of the time you're not sure whether there's an esoteric but idiomatic way to do it, or you really need to implement something custom yourself.

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

#77
post #64
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…

Doesn't HTMX work via HATEOAS so would require a full RESTful backend?

You can just respond back anything and it'll work. You can just respond a flat non-hypermedia JSON and have some JavaScript listen to the event and process it with whatever semantics you want (although it'd be weird for you to do that, but I just tried it and yeah it works).

I still don't understand what they mean when they say "HTMX is HATEOAS": it's not parsing the response to decide things based on relations, it's not following any links, you can still have out-of-band info if you want...it's just substituting a string given by the server on the DOM.

A JSON API can be as hypermedia as HTML (I remember HAL-FORMS and Collection+JSON). A web app that consumes such an API is doing "HATEOAS" even if it's using React.

I really like the HTMX project (that and Unpoly are a godsend) but sometimes it sounds more grandiose than it is: just the regular web doing what it always did, except you program the interactive fetching/swapping of pages/fragments in HTML instead of JS, i.e. AJAX with HTML attributes.

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

#79
I wish there was something like Streamlit, but for non-data apps. Personal sites, blogs, etc... Something that skipped templating and allowed me to declare compenents in a high level way.

ST was easily the most pleasant experience I've ever had developing front end using a Python backend.

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

#80
post #49

Shame there's no jinja support, I really can't stand Django templates.

You can use Jinja with Django https://docs.djangoproject.com/en/4.2/topics/templates/#djan...

I do use Jinja with Django, hence me being disappointed that it's not supported by Unicorn.
Post reply on HN