Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jonathan-s/django-sockpuppet
Build reactive applications with the django tooling you already know and love.
https://github.com/jonathan-s/django-sockpuppet
django django-channels hacktoberfest liveview phoenix-liveview python reactive stimulusreflex websocket websockets
Last synced: about 1 month ago
JSON representation
Build reactive applications with the django tooling you already know and love.
- Host: GitHub
- URL: https://github.com/jonathan-s/django-sockpuppet
- Owner: jonathan-s
- License: mit
- Created: 2020-02-08T11:52:48.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T14:36:38.000Z (almost 2 years ago)
- Last Synced: 2024-05-19T06:02:41.197Z (6 months ago)
- Topics: django, django-channels, hacktoberfest, liveview, phoenix-liveview, python, reactive, stimulusreflex, websocket, websockets
- Language: Python
- Homepage: https://github.com/jonathan-s/django-sockpuppet
- Size: 2.54 MB
- Stars: 442
- Watchers: 9
- Forks: 25
- Open Issues: 34
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Security: docs/security.md
Awesome Lists containing this project
- awesome-python-web-frameworks - Django-Suckpuppet - Build reactive applications with the django tooling you already know and love. (Front-end frameworks / More)
README
Welcome to Sockpuppet 👋
### 🎉 **You just discovered an exciting new way to build modern, reactive, real-time apps with Django.**
**Why should I spend time exploring this?** If you use current frontend libraries, such as react, vue or angular you end up creating state for the frontend and then updating state changes in the backend through an api.
This means that you forgo server-rendered html with the advantages that brings + you'll end up with a more complex app overall.
With this library you can still use normal django templates, and any frontend state you change will be directly reflected in the backend. Currently this happens through the use of websockets.
This is the django implementation of the excellent rails library [stimulus-reflex][1], which in turn is inspired by [Phoenix LiveView][2].
Hit me up on twitter if you have any questions. [![Twitter follow](https://img.shields.io/twitter/follow/argparse?style=social)](https://twitter.com/argparse)
## 📚 Documentation
- [Official Documentation](https://sockpuppet.argpar.se/)
## ⚡️ Get started
```bash
pip install django-sockpuppet# If performance is important you can take advantage lxml parsing
# It will typically speed up the round trip by 30-90ms depending on the html
pip install django-sockpuppet[lxml]# Add these into INSTALLED_APPS in settings.py
INSTALLED_APPS = [
'channels',
'sockpuppet'
]# generates scaffolding for webpack.config.js and installs required js dependencies
# if you prefer to do that manually read the more thorough documentation
python manage.py initial_sockpuppet# scaffolds a new reflex with everything that's needed.
python manage.py generate_reflex app_name name_of_reflex
```You're almost there, read about how to tie it all together in the [quickstart documentation][3]
## 💙 Community
- [Discord](https://discord.gg/XveN625) - We share the discord together with stimulus-reflex, and there is a channel dedicated for python/django discussions.
- [django-sockpuppet-expo](https://github.com/zodman/django-sockpuppet-expo) - Do you want more examples? There code examples of chats, book search, etc ... We accept PRs :)## 🛠 Development in the repo
See some common commands that can be useful for development
```bash
pip install -r requirements_dev.txt
invoke -l
```Try out a minimal example manually
```
git clone [email protected]:jonathan-s/django-sockpuppet.git
npm install
npm run build:test
python manage.py runserver
# visit https://localhost:8000/test
```## ⛑ Running tests locally
The most important tests are integration tests that makes sure that frontend and backend work together in conjunction with each other.```
# Install the cypress et al
npm install# Spin up a dev server that uses some fixtures
inv test-server# Run the cypress tests
npm run cypress:run
```## 🔜 Release
```
pip install -r requirements_dev.txt
invoke release -b feature
```[1]: https://github.com/hopsoft/stimulus_reflex
[2]: https://youtu.be/Z2DU0qLfPIY?t=670
[3]: https://sockpuppet.argpar.se/quickstart-django