Introduction to JustPy | A Web Framework based on Python
Last Updated :
24 Apr, 2025
JustPy is a web framework that leverages the power of Python to create web applications effortlessly. In this article, we'll explore JustPy, its features, and why it's gaining attention among developers.
What is the JustPy Module of Python?
The JustPy module of Python is a web framework like Django but it is an oriented, Component-Based, and High-level framework with required zero Front End Programming. Users who don't know Frontend technologies like JavaScript can easily build some interactive websites without any Frontend knowledge, just by using Python Code and not a single line of JavaScript.
In JustPy, the methods or classes which is used to create the webpage elements are known as Component Class. This Component Classes will hold the user-defined custom elements inside it and users can use them as many times as they want, without writing the same design twice. Using these component classes, we can differentiate between different designs, functionalities, etc. from the other designs or component classes so that they don't overlap with each other.
JustPy also supports the SVG and HTML components alongside some more complex features like Charts and Grids with the help of the Matplotlib library of Python. It also supports other Python libraries like Pandas, and even with a Pandas extension which helps the user create interactive charts or grids using the Pandas Datastructures like Series and Dataframe.
Features of JustPy
- Uses Python Syntax - The JustPy module is purely based upon the Python language and it uses Pythonic syntax, which makes it easier for developers who know Python and can easily learn and use it.
- Real-Time Applications - JustPy supports real-time functionality, which means that it lets the developers create interactive and responsive web applications without the use of languages like JavaScript.
- Support Events - Developers can create Python functions and those functions will react based upon certain events, such as clicking a button.
- Supports Component-Based Architecture - As JustPy follows an object-oriented approach, all the classes or functions used act as reusable components, so that the developers can use them as many times as possible and it makes the code short and concise.
- No external support needed by default - Although, if the developers want they can manually use HTML or CSS to make the application more complex or add extra features, by default JustPy doesn't need any of those to work, it depends solely upon Python
Advantages of JustPy
- Event Driven Programming - Just like modern JavaScript Frameworks, React and Vue.JS, it follows an Even Driven Architecture. Developers can create certain Python functions and make them react on specific events like clicking a button, hovering over something etc. The event driven approach makes it simple to handle user interactions with the Web Applications.
- Reactive Programming - JustPy supports Reactive programming, which updates the UI of the web application automatically if something has been changed in the code. No need to reload it manually, this reactive approach leads to simpler UI development by reducing the need of explicit and excessive DOM manipulation.
- No Front End Framework Needed - By default, JustPy doesn't need any external front end technologies like JavaScript, HTML, CSS etc. JustPy can build complete web applications just by using Python. Developers' can use HTML or CSS if needed, but it is not necessary to build web applications in JustPy.
- Built-in Chart Support - JustPy also provides a built-in chart support system, which lets the developers to create interactive charts without using any other modules.
- Cross Platform Support - As Python supports multiple platforms like Windows, MacOS, Linux etc, JustPy also supports cross-platform development.
- Rapid Prototyping - JustPy's Pythonic syntax makes it well-suited for rapid prototyping, developers can quickly develop and test web applications without the need of external complex web developments setups.
Displaying a simple "Hello Geeks" message using JustPy
To install justpy use this command.
pip install justpy
This function is used to display something on the browser.
Python3
import justpy as jp
def hello_world_function():
web_page = jp.WebPage()
div = jp.Div(text='Hello Geeks')
web_page.add(div)
return web_page
jp.justpy(hello_world_function)
Running the Program
python <filename>.py
The code will be deployed in 127.0.0.1:8080, i.e localhost and port number 8080.

Output

Basic Concepts related to JustPy
Components
As stated earlier, JustPy components are classes that contains specific design or code which can be resued by the user just by creating an object of it and calling it via the object. In the above example -
div = jp.Div(text='Hello Geeks')
This line is similar to the HTML version -
<div> Hello Geeks </div>
Web Pages
Web Pages are also a component of JustPy and they are instance of the WebPage class of JustPy. We need to first create an instance of it then add elements as we want.
web_page = jp.WebPage()
The variable web_page is storing the instance of the WebPage() class. Now we can add text or any other element by calling add() method.
web_page.add(div)
Finally, we need to return the object of the WebPage class, i.e in which we have instantiated the class and stored it.
Adding some Basic HTML Components
Adding a Button
We can add some responsive button in our webpage too using JustPy. The button will show some text before clicking, and that will change after we have clicked it. It is like the innerHTML concept of JavaScript DOM.
Python3
import justpy as jp
# Defining the Button configuration like color , text font etc.
button_class='m-2 bg-blue-500 hover:bg-green-700 text-white font-bold py-2 px-4 rounded'
def on_clicked(self, msg):
self.text = 'Oh! Hi Geek!'
def button_event():
wp = jp.WebPage()
d = jp.Button(text='I don\'t know You Yet', a=wp, classes=button_class)
d.on('click', on_clicked)
return wp
jp.justpy(button_event)
Output

Adding Hover Reaction
Now we will use a button and add some response when the user hovers over it. We will use Three functions / Components here.
- First one will define the behaviour of the button when it is clicked.
- Second one will define the behaviour when the user is hovering over the button.
- Third one will define when the user left the button or stop hovering over it and moved other way.
As we are using three functions here with different functionalities it as another example of handling multiple events at once.
Python3
import justpy as jp
def click_fun(self, msg):
self.text = 'This button has been clicked'
self.set_class('bg-blue-500')
def hover_function(self, msg):
self.text = 'The mouse pointer is hovering over'
self.set_class('bg-red-500')
def hover_function_reaction(self, msg):
self.text = 'The mouse Pointer left'
self.set_class('bg-green-500')
def main_hover():
wp = jp.WebPage()
d = jp.Div(text='Button not Clicked yet', a=wp,
classes='w-64 text-2xl m-2 p-2 bg-blue-500 text-white rounded',
click=click_fun, mouseenter=hover_function,
mouseleave=hover_function_reaction)
return wp
jp.justpy(main_hover)
Output

Adding Italics Text
This Python script uses the JustPy library to create a web page displaying the text "GeeksforGeeks in Italic" in an italic format. It defines a function 'italic_text()' that sets up the web page and adds the italic text. When executed, it runs as a JustPy web application, serving the page with the formatted text.
Python3
import justpy as jp
def italic_text():
wp = jp.WebPage()
jp.I(text='GeeksforGeeks in Italic', a=wp)
return wp
jp.justpy(italic_text)
Output

Adding a Line Break
This script uses the JustPy library to create a web page with italicized text and a line break. It imports JustPy as jp, defines a function (line_break_demo), and adds text elements to the page. It then returns the web page object. When executed, it serves this web page.
Python3
import justpy as jp
def line_break_demo():
wp = jp.WebPage()
jp.I(text='GeeksforGeeks in Italic', a=wp)
jp.Br(a=wp)
jp.P(text="Text after line Break", a=wp)
# jp.Strong(text='Text in the Strong element', a=wp)
return wp
jp.justpy(line_break_demo)
Output

Adding a Bold Text
This script uses the JustPy library to create a web page with italicized text, a line break, and bold text. It imports JustPy as jp, defines a function (bold_text), and adds text elements to the page. It returns the web page object. When executed, it serves this web page.
Python3
import justpy as jp
def bold_text():
wp = jp.WebPage()
jp.I(text='GeeksforGeeks in Italic', a=wp)
jp.Br(a=wp)
jp.Strong(text="Bold Text after line Break", a=wp)
return wp
jp.justpy(bold_text)
Output

HTML Links (Anchor Tag)
This script uses the JustPy library to create a web page with italicized text, a line break, bold text, and a hyperlink. It imports JustPy as jp, defines a function (bold_text), and adds various text elements to the page, including a hyperlink to "Best Place to learn DSA" with a link to GeeksforGeeks. It returns the web page object. When executed, it serves this web page.
Python3
import justpy as jp
def bold_text():
wp = jp.WebPage()
jp.I(text='GeeksforGeeks in Italic', a=wp)
jp.Br(a=wp)
jp.P(text="Bold Text after line Break", a=wp)
jp.Br(a=wp)
jp.A(text="Best Place to learn DSA",href="https://www.geeksforgeeks.org/",
a=wp, classes='m-2 p-2 text-xl text-white bg-green-500 hover:bg-green-700')
return wp
jp.justpy(bold_text)
Output


Similar Reads
Introduction to NiceGUI - A Python based UI framework
In this article, we will learn about NiceGUI, It is a Python-based UI Framework, which shows up in Web Browsers and we can create buttons, dialogs, Markdown, 3D scenes, plots, and much more. It works well for dashboards, robotics initiatives, smart house solutions, and other related use cases. Addit
5 min read
Introduction to Bottle Web Framework - Python
There are many frameworks in python which allows you to create webpage like bottle, flask, django. In this article you will learn how to create simple app bottle.Bottle is a fast, simple and lightweight WSGI micro web-framework for Python. It is distributed as a single file module and has no depende
2 min read
Introduction to Sanic Web Framework - Python
WHAT IS SANIC? Sanic is an asynchronous web framework and web server for Python 3.5+ thatâs written to go fast. Sanic was developed at MagicStack and is based on their uvloop event loop, which is a replacement for Python asyncioâs default event loop, thereby making Sanic blazing fast. Syntactically
6 min read
Introduction to Tornado Framework
Tornado is a robust Python asynchronous networking library and web framework, is available as an open-source project. Given that it is made to manage non-blocking, asynchronous processes, it is appropriate for developing high-performance, scalable web apps. Since its creation, Tornadoâwhich was firs
3 min read
Introduction to Python for Absolute Beginners
Are you a beginner planning to start your career in the competitive world of Programming? Looking resources for Python as an Absolute Beginner? You are at the perfect place. This Python for Beginners page revolves around Step by Step tutorial for learning Python Programming language from very basics
6 min read
Introduction to Python Black Module
Python, being a language known for its readability and simplicity, offers several tools to help developers adhere to these principles. One such tool is Black, an uncompromising code formatter for Python. In this article, we will delve into the Black module, exploring what it is, how it works, and wh
5 min read
Data Classes in Python | An Introduction
dataclass module is introduced in Python 3.7 as a utility tool to make structured classes specially for storing data. These classes hold certain properties and functions to deal specifically with the data and its representation.DataClasses in widely used Python3.6Â Although the module was introduced
3 min read
Top 8 Python Frameworks for MicroServices
Microservices architecture has gained immense popularity for developing scalable and maintainable applications. This architectural style allows developers to build applications as a collection of loosely coupled services, which can be developed, deployed, and scaled independently. Python, with its r
6 min read
Python Falcon Introduction
Python Falcon is a lightweight, high-performance web framework that's well-suited for building RESTful APIs. It's easy to learn, efficient, and perfect for projects where speed and simplicity are priorities. In this article, we introduced Falcon and created a basic "Hello World" application to help
4 min read
Introduction to Python Pydantic Library
In modern Python development, data validation and parsing are essential components of building robust and reliable applications. Whether we're developing APIs, working with configuration files, or handling data from various sources, ensuring that our data is correctly validated and parsed is crucial
6 min read