A magical fullstack framework for Django.
Project description
django-unicorn
The magical fullstack framework for Django. ✨
django-unicorn
provides a way to use backend Django code and regular Django templates to create interactive experiences without investing in a separate frontend framework.
Why?
Building server-side sites in Django with the ORM and template engine is so pleasant, but once you need more interactivity on the frontend, there is a lot more ambiguity. Should you build out an entire API in Django REST framework? Should you use React or Vue.js (or some) other frontend framework?
It seems like there should be an easier way to create interactive experiences.
A note on beta software
django-unicorn
is beta software and the API will likely change on the way to 1.0. All efforts will be made to include an easy upgrade path. 1.0.0 will signify that the API won't change until the next major release.
Site
https://www.django-unicorn.com
Demo
https://github.com/adamghill/django-unicorn/blob/master/demo.mp4
Install
git clone git@github.com:adamghill/django-unicorn.git
pip install -e ../django-unicorn
- Add
django_unicorn
andunicorn
toINSTALL_APPS
in your Django settings file - Add
path("unicorn/", include("django_unicorn.urls")),
into your project'surlpatterns
inurls.py
- Add
{% load unicorn %}
to the top of your base template file - Add
{% unicorn_styles %}
and{% unicorn_scripts %}
into your base HTML file
How to create a component
python manage.py startunicorn hello-world
- Add
{% unicorn 'hello-world' %}
into the template you want to load the newhello-world
component - Take a look at
hello_world
class andhello-world.html
template
Current functionality
unicorn_styles
,unicorn_scripts
,unicorn
template tags- Base
component
class - Handles text input, checkbox, select options, select multiple options
Developing
git clone git@github.com:adamghill/django-unicorn.git
poetry install
poetry run example/manage.py migrate
poetry run example/manage.py runserver 0:8000
- Go to
localhost:8000
in your browser - To install in another project
pip install -e ../django-unicorn
Minify Javascript
npm install
npm run-script build
Bump version
npm run-script build
poetry version major|minor|patch
- Commit/push version bump
poetry publish --build -r pypi -u __token__
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django_unicorn-0.2.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d64988756608139472ad65732acab3603c7edef108edbe198cce8f5fc7d5865 |
|
MD5 | 1cb5b1fb88335f37bdda9383d9fa6dcc |
|
BLAKE2b-256 | cead02e1ce8cbac93bfbaf4d4915a06cd374878ca53152e8888ef34de1865cec |