Skip to main content

Write responsive web apps in full python

Project description

Lona logo license MIT python 3 latest version ci status code coverage

Lona is a web application framework, designed to write responsive web apps in full Python.

Demos: lona-web.org/demos

FAQ: lona-web.org/faq

Documentation: lona-web.org

Changelog: lona-web.org/changelog

Reddit: reddit.com/r/lona_web_org/

Discord: discord.com/lona-web.org

Web is a solved problem in Python since ages, but traditionally Python handles only the server side. If you want to have client side interaction like click events or you want update content live, you have to write an additional Javascript application.

Lona handles the server side and the client side, and provides a simple, pythonic API to write self contained views.

# pip install lona
from lona.html import HTML, Button, Div, H1
from lona import LonaApp, LonaView

app = LonaApp(__file__)


@app.route('/')
class MyView(LonaView):
    def handle_button_click(self, input_event):
        self.message.set_text('Button clicked')

    def handle_request(self, request):
        self.message = Div('Button not clicked')

        html = HTML(
            H1('Click the button!'),
            self.message,
            Button('Click me!', handle_click=self.handle_button_click),
        )

        return html


if __name__ == '__main__':
    app.run(port=8080, live_reload=True)

More information: Getting Started

How does it work?

Lona comes with a Javascript based browser library that speaks a specialized protocol with the backend. This protocol specifies messages like “hey frontend, please show $HTML” and “hey backend, someone clicked on node XY”.

More information: Basic Concept

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

lona-1.16.2.tar.gz (127.2 kB view details)

Uploaded Source

Built Distribution

lona-1.16.2-py3-none-any.whl (146.3 kB view details)

Uploaded Python 3

File details

Details for the file lona-1.16.2.tar.gz.

File metadata

  • Download URL: lona-1.16.2.tar.gz
  • Upload date:
  • Size: 127.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.4

File hashes

Hashes for lona-1.16.2.tar.gz
Algorithm Hash digest
SHA256 539a2a7edc0738c7f5578826182e28e9c58598bd2e0232833ff843b37f8b1640
MD5 88a122c03e22e0e02df985918f69d096
BLAKE2b-256 956ac9b249afb6047d65d739992c0f08f5b68bec31d02b9d18c5d0effc42435b

See more details on using hashes here.

File details

Details for the file lona-1.16.2-py3-none-any.whl.

File metadata

  • Download URL: lona-1.16.2-py3-none-any.whl
  • Upload date:
  • Size: 146.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.4

File hashes

Hashes for lona-1.16.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8440fa28779ac1645fb4cfd8c763a17f34fbcde08262f9f6eb9533014c095837
MD5 025ab99a21c5f9e6c2d8f402bad532c3
BLAKE2b-256 919fb2115d3042b0b99cbbb49d5ecc8fd3948b2f4d70798deecf0e7ef8c362a5

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