Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

It's React, but in Python. Now with Django integration.

License

NotificationsYou must be signed in to change notification settings

reactive-python/reactpy-django

Repository files navigation

ReactPy-Django

ReactPy-Django is used to addReactPy support to an existingDjango project. This package also turbocharges ReactPy with features such as...

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 inReactJS. 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-inExternal
Flask, FastAPI, Sanic, TornadoDjango,Jupyter,Plotly-Dash

At a Glance

my_app/components.py

You will need a file to define yourReactPy components. We recommend creating acomponents.py file within your chosenDjango app to start out. Within this file, we will create a simplehello_world component.

fromreactpyimportcomponent,html@componentdefhello_world(recipient:str):returnhtml.h1(f"Hello{recipient}!")

In yourDjango app's HTML template, you can now embed your ReactPy component using thecomponent template tag. Within this tag, you will need to type in the dotted path to the component.

Additionally, you can pass inargs andkwargs into your component function. After reading the code below, pay attention to how the function definition forhello_world (from the previous example) accepts arecipient argument.

{%loadreactpy%}<!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.

About

It's React, but in Python. Now with Django integration.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

 

[8]ページ先頭

©2009-2025 Movatter.jp