https://github.com/lona-web-org/lona
Write responsive web apps in full python
https://github.com/lona-web-org/lona
framework hacktoberfest python3 web
Last synced: 10 months ago
JSON representation
Write responsive web apps in full python
- Host: GitHub
- URL: https://github.com/lona-web-org/lona
- Owner: lona-web-org
- License: mit
- Created: 2020-08-21T06:33:50.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-12-31T02:51:37.000Z (about 1 year ago)
- Last Synced: 2025-04-18T22:37:31.425Z (11 months ago)
- Topics: framework, hacktoberfest, python3, web
- Language: Python
- Homepage:
- Size: 14.2 MB
- Stars: 532
- Watchers: 13
- Forks: 26
- Open Issues: 14
-
Metadata Files:
- Readme: README.rst
- License: LICENSE.txt
Awesome Lists containing this project
README
.. image:: doc/content/logo.svg
:alt: Lona logo
:height: 200px
:width: 200px
.. image:: https://img.shields.io/pypi/l/lona.svg
:alt: license MIT
:target: https://pypi.org/project/lona
.. image:: https://img.shields.io/pypi/pyversions/lona.svg
:alt: python 3
:target: https://pypi.org/project/lona
.. image:: https://img.shields.io/pypi/v/lona.svg
:alt: latest version
:target: https://pypi.org/project/lona
.. image:: https://github.com/lona-web-org/lona/actions/workflows/ci.yml/badge.svg
:alt: ci status
:target: https://github.com/lona-web-org/lona/actions/workflows/ci.yml
.. image:: https://img.shields.io/codecov/c/github/lona-web-org/lona.svg
:alt: code coverage
:target: https://codecov.io/gh/lona-web-org/lona/
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.
.. code-block:: text
# pip install lona
.. code-block:: python
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 `_