Git Product home page Git Product logo

lona's Introduction

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

lona's People

Contributors

fscherf avatar dependabot[bot] avatar maratori avatar markusgritsch avatar hut avatar sobolevn avatar smithchart avatar avdn avatar rohieb avatar m-reichle avatar laundmo avatar chlor2 avatar korantu avatar rominf avatar stock90975 avatar ukleinek avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.