It's React, but in Python. Now with Django integration.
Project description
ReactPy-Django
ReactPy-Django is used to add ReactPy support to an existing Django project. This package also turbocharges ReactPy with features such as...
- SEO compatible rendering
- Client-Side Python components
- Single page application (SPA) capabilities
- Distributed computing
- Performance enhancements
- Customizable reconnection behavior
- Customizable disconnection behavior
- Multiple root components
- Cross-process communication/signaling (Channel Layers)
- 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-5.0.0.tar.gz
.
File metadata
- Download URL: reactpy_django-5.0.0.tar.gz
- Upload date:
- Size: 1.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a930de7272e27d97e39b619583077af741bc19343e265e3fe8da6d876d31d84 |
|
MD5 | e0d5cf4d4a004d2418da72d6879eaad2 |
|
BLAKE2b-256 | a54ab1983f2e314823aefa904968015ed363fa1bfe4921a17a85ad3d3cb9aa74 |
Provenance
File details
Details for the file reactpy_django-5.0.0-py3-none-any.whl
.
File metadata
- Download URL: reactpy_django-5.0.0-py3-none-any.whl
- Upload date:
- Size: 1.5 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9001008f1127008d8c50b7ed0eac01c0ff1c464bd267bef4ea55b331e74770f2 |
|
MD5 | cd69bab6c75a1fc3385bab0afbbe6029 |
|
BLAKE2b-256 | eabdad04a35b853e8d35cc006fa96d20d5403a0d722eddab86748496e7256c49 |