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


app.run(port=8080)

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.11.tar.gz (74.9 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: lona-1.11.tar.gz
  • Upload date:
  • Size: 74.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for lona-1.11.tar.gz
Algorithm Hash digest
SHA256 b23b9ecde61a41b8e52cd21bb6f595bec0cb77c419d4596f04960004ba0d5087
MD5 823784d26d0fd22cf1afbc478e051a96
BLAKE2b-256 e64bf69e2d2b122bc76808d84b02694db0400520fcb279e1cf924fbae8c4248e

See more details on using hashes here.

Supported by

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