Do I need to learn a new frontend framework for
django-unicorn gives you some magical template tags and HTML attributes to sprinkle in normal Django HTML templates. The backend code is a simple class that ultimately derives from
TemplateView. Keep using the same Django HTML templates, template tags, filters, etc and the best-in-class Django ORM without learning another new framework of the week.
Do I need to build an entire API to use
Django REST framework is pretty magical on its own, and if you will need a mobile app or other use for a REST API, it's a great set of abstractions to follow REST best practices. But, it can be challenging implementing a robust API even with
Django REST framework. And I wouldn't even attempt to build an API up from scratch unless it was extremely limited.
Do I need to need to install GraphQL to use
Nope! GraphQL looks like an awesome technology for specific use-cases and solves some pain points around creating a RESTful API. But, it is another peiece of technology to wrestle with.
Do I need to run an annoying separate node.js process or learn any tedious Webpack configuration incantations to use
django-unicorn installs just like any normal Django package and is seamless to implement. There are a few "magic" attributes to sprinkle into a Django HTML template, but other than that it's just like building a regular server-side application.
Does this replace Vue.js or React?
Nope! In some cases, you might need to actually build an SPA in which case
django-unicorn really isn't that helpful. In that case you might have to invest the time to learn a more involved frontend framework. Read Using VueJS alongside Django for one approach.
Isn't calling an AJAX endpoint on every input slow?
django-unicorn is ideal for when an AJAX call would already be required (such as hitting an API for typeahead search or update data in a database). If that isn't required, the lazy and debounce modifiers can also be used to prevent an AJAX call on every change.
But, what about security?
django-unicorn follows the best practices of Django and requires a CSRF token to be set on any page that has a component. This ensures that no nefarious AJAX POSTs can be executed.
django-unicorn also creates a unique component checksum with the Django secret key on every data change which also ensures that all updates are valid.
What browsers does
django-unicorn mostly targets modern browsers, but the project would appreciate any PRs to help support legacy browsers.
django-unicorn is released?
django-unicorn works great with whitenoise's ability to serve static assets with a filename based on a hash of the file. CompressedManifestStaticFilesStorage works great for this purpose and is used by django-unicorn.com for this very purpose. Example code can be found at https://github.com/adamghill/django-unicorn.com/.