Skip to main content

Control the web with Python

Project description

Django IDOM · Tests PyPI Version License

Django-IDOM connects your project to a ReactJS frontend, allowing you to create interactive websites without needing JavaScript!

Following ReactJS styling, web elements are combined into reusable "components". These components can utilize hooks and events to create infinitely complex web pages.

When needed, IDOM can use components directly from NPM. For additional flexibility, components can also be fully developed in JavaScript.

Any Python web framework with Websockets can support IDOM. See below for what frameworks are supported out of the box.

Supported Frameworks Supported Frameworks (External)
Flask, FastAPI, Sanic, Tornado Django, Plotly-Dash, Jupyter

At a Glance

my_app/components.py

You'll need a file to define your IDOM components. We recommend creating a components.py file within your chosen Django app to start out.

from idom import component, html

@component
def HelloWorld(recipient: str):
    return html.h1(f"Hello {recipient}!")

my_app/templates/my-template.html

In your Django app's HTML located within your templates folder, you can now embed your IDOM component using the component template tag. Within this tag, you will need to type in your dotted path to the component function as the first argument.

Additonally, you can pass in keyword arguments into your component function. For example, after reading the code below, pay attention to how the function definition for HelloWorld (in the previous example) accepts a recipient argument.

{% load idom %}
<!DOCTYPE html>
<html>
  <body>
    {% component "example_project.my_app.components.HelloWorld" recipient="World" %}
  </body>
</html>

Resources

Follow the links below to find out more about this project.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_idom-1.0.0.tar.gz (261.2 kB view details)

Uploaded Source

Built Distribution

django_idom-1.0.0-py2.py3-none-any.whl (266.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django_idom-1.0.0.tar.gz.

File metadata

  • Download URL: django_idom-1.0.0.tar.gz
  • Upload date:
  • Size: 261.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for django_idom-1.0.0.tar.gz
Algorithm Hash digest
SHA256 fbf1b0c02e080bd3b5c1113bf86fedbf4de7b129aa36e112bff6b1253b596530
MD5 ad6cf670da21f9beb41b00652cadca27
BLAKE2b-256 933beb6c6caca879519afab8f9ec43354bf1f71931fd107d59cbdb4204735cf6

See more details on using hashes here.

File details

Details for the file django_idom-1.0.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_idom-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 15d9a7790c5b546566a6d8db00da14760f81ed3e17ce9574aa0e22184d5967aa
MD5 9512e4cb48be3f38a573e63b2916d719
BLAKE2b-256 482db0ab7e3881cb879136f9e28d44b6885e06be01f83e33c17c712c2c7aeeda

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page