前端框架选型是企业提升开发效率与用户体验的关键因素
1321
2022-10-22
JustPy是一个面向对象的,基于组件的高级Python Web框架,不需要前端编程
JustPy
JustPy Docs and Tutorials
Introduction
JustPy is an object-oriented, component based, high-level Python Web Framework that requires no front-end programming. With a few lines of only Python code, you can create interactive websites without any JavaScript programming. JustPy can also be used to create graphic user interfaces for Python programs.
Unlike other web frameworks, JustPy has no front-end/back-end distinction. All programming is done on the back-end allowing a simpler, more productive, and more Pythonic web development experience. JustPy removes the front-end/back-end distinction by intercepting the relevant events on the front-end and sending them to the back-end to be processed.
In JustPy, elements on the web page are instances of component classes. A component in JustPy is a Python class that allows you to instantiate reusable custom elements whose functionality and design is encapsulated away from the rest of your code.
Custom components can be created using other components as building blocks. Out of the box, JustPy comes with support for HTML and SVG components as well as more complex components such as charts and grids. It also supports most of the components and the functionality of the Quasar library of Material Design 2.0 components.
JustPy encourages creating your own components and reusing them in different projects (and, if applicable, sharing these components with others).
JustPy supports visualization using matplotlib and Highcharts.
JustPy integrates nicely with pandas and simplifies building web sites based on pandas analysis. JustPy comes with a pandas extension that makes it simple to create interactive charts and grids from pandas data structures.
For updates and news please follow the JustPy Twitter account
Hello World!
import justpy as jpdef hello_world(): wp = jp.WebPage() d = jp.Div(text='Hello world!') wp.add(d) return wp jp.justpy(hello_world)
The program above activates a web server that returns a web page with 'Hello world!' for any request. Locally, you would direct your browser to http://127.0.0.1:8000 or http://localhost:8000/ or to see the result.
Here is a slightly modified version in which 'Hello world!' changes to 'I was clicked!' when it is clicked.
import justpy as jpdef my_click(self, msg): self.text = 'I was clicked!'def hello_world(): wp = jp.WebPage() d = jp.Div(text='Hello world!') d.on('click', my_click) wp.add(d) return wpjp.justpy(hello_world)
Many other examples can be found in the tutorial
Under the Hood
JustPy's backend is built using:
starlette - "a lightweight ASGI framework/toolkit, which is ideal for building high performance asyncio services".uvicorn - "a lightning-fast ASGI server, built on uvloop and httptools".
JustPy's frontend (which is transparent to JustPy developers) is built using:
Vue.js - "The Progressive JavaScript Framework"
The way JustPy removes the frontend/backend distinction is by intercepting the relevant events on the frontend and sending them to the backend to be processed.
License
Apache License, Version 2.0
Copyright (c) 2019, Eliezer Mintz
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~