r/django • u/JuroOravec • 2h ago
For the last year I was building Citry: a typed Python frontend for Django that's faster and smarter than Django or Jinja templates
galleryThis week I released Citry v1.0, a fast and powerful frontend framework for Python. You can now build Django apps with the same speed, convenience and tooling you're used to in Vue or React, without a separate JavaScript project.
To get a feel for it, see the intro tutorial.
Overview:
- A component is a Python class with its HTML, CSS and JS, plus a typed class for its inputs.
- Really fast, faster than Jinja*.
- Citry catches errors for invalid inputs, typos across the HTML, CSS, and JS, etc.
- To see the errors in your IDE, install the IDE integration (VSCode). This also adds syntax highlighting.
- Or run a static check in your CI with a CLI command.
- Feature-rich and extensible - Python event handlers, supports translations (i18n), caching, CSP, and more.
Django integration:
- To use Citry in a Django project, see this Django guide.
- To call Citry components WITHIN your existing Django templates, see citry-django.
- Or see this starter project for how such integration looks.
Coming from django-components? There's a migration guide: https://citry.dev/guides/migrate-from-django-components/
Links:
- Try it in the browser: https://citry.dev/playground/
- The full story: https://citry.dev/blog/citry-1-0-0/
- GitHub: https://github.com/citry-dev/citry
Next steps:
I want to make Citry the go-to frontend for Django apps, to make the Django ecosystem a safer (less buggy) place. Please share and promote this project.
If you want help trying out Citry in your Django project, reach out to me here, Discord, or email.
For any questions or missing features, visit our Discord.
PS:
Citry is the successor to django-components. Citry was in development for a year, sponsored by Hendrik Richter and OhneMakler Österreich GmbH. Thank you to everyone who supported the project ❤️
* Measured from a request to a user click.