It's React, but in Python. Now with Django integration.
Project description
ReactPy Django
ReactPy-Django is used to add used to add ReactPy support to an existing Django project. This package also turbocharges ReactPy with features such as...
- SEO compatible rendering
- Single page application (SPA) capabilities
- Distributed computing
- Performance enhancements
- Customizable reconnection behavior
- Customizable disconnection behavior
- Multiple root components
- Django view to ReactPy component conversion
- Django static file access
- Django database access
What is ReactPy?
ReactPy is a library for building user interfaces in Python without Javascript. ReactPy interfaces are made from components that look and behave similar to those found in ReactJS. Designed with simplicity in mind, ReactPy can be used by those without web development experience while also being powerful enough to grow with your ambitions.
Supported Backends | |
---|---|
Built-in | External |
Flask, FastAPI, Sanic, Tornado | Django, Jupyter, Plotly-Dash |
At a Glance
my_app/components.py
You will need a file to define your ReactPy components. We recommend creating a components.py
file within your chosen Django app to start out. Within this file, we will create a simple hello_world
component.
from reactpy import component, html
@component
def hello_world(recipient: str):
return html.h1(f"Hello {recipient}!")
my_app/templates/my-template.html
In your Django app's HTML template, you can now embed your ReactPy component using the component
template tag. Within this tag, you will need to type in the dotted path to the component.
Additionally, you can pass in args
and kwargs
into your component function. After reading the code below, pay attention to how the function definition for hello_world
(from the previous example) accepts a recipient
argument.
{% load reactpy %}
<!DOCTYPE html>
<html>
<body>
{% component "example_project.my_app.components.hello_world" recipient="World" %}
</body>
</html>
Resources
Follow the links below to find out more about this project.
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
File details
Details for the file reactpy_django-3.7.0.tar.gz
.
File metadata
- Download URL: reactpy_django-3.7.0.tar.gz
- Upload date:
- Size: 87.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48432e8a1f4560683c223f0bdf1589e53957ec406c3a92b58c706ca55a74c104 |
|
MD5 | a9296997acc6a1a18e915c781c8b7cc9 |
|
BLAKE2b-256 | b89e3a5a8b09454757ea35969a5cf0547b26943719b22481cbefaaf807b36806 |
File details
Details for the file reactpy_django-3.7.0-py2.py3-none-any.whl
.
File metadata
- Download URL: reactpy_django-3.7.0-py2.py3-none-any.whl
- Upload date:
- Size: 95.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cbf8f45f0ddca4cd493dcf9c5f18fd46b8d59016215db3ef6534275e7b83be5e |
|
MD5 | fdcc096abbaa5a34a008e17cfbd3c3a1 |
|
BLAKE2b-256 | ccf0ef45dff94dab19ce867ba1ef154a0adf80b9c8783c44937fb7e5cd78ea61 |