A lightweight and highly customizable Python framework for building web applications
Project description
Mango Framework
Introduction
Mango is a lightweight Python framework for building web applications. It provides a simple and intuitive way to handle routing, render HTML templates, and serve files. With Mango, you can quickly set up a web server and define routes to handle different HTTP requests. It is made to be accessible and highly modifiable even by beginners to learn and eventually move on to more mature frameworks such as Flask or Bottle. You only need python3 to run Mango and nothing else.
Features
- Easy routing configuration
- Rendering HTML templates
- Serving static files
- Handling JSON data
- Handling of basic form data
- Lightweight and minimal dependencies
- Suitable for small to medium-sized web applications
- Human readible code even beginners could modify
- Integrated basic ORM for DB functions
- Integrated basic Template engine Shake
Installation
Mango can be easily installed via pip:
pip install mango-framework
Usage
- Import the necessary modules and functions from Mango:
from mango import route, run, render, send_json, send_file, Shake, get_json
- Define your routes using the @route() decorator:
@route('/')
def index():
return "Hello, Mango!"
- Get JSON data:
@route('/post')
def post(post):
user = get_json(post)
return f"Hello, {user['name']}!"
- Send JSON data:
@route('/send')
def send():
return send_json({'name':'john'})
- Send a file for the user to download:
@route('/download')
def download():
return send_file('image.jpeg')
- Render the HTML to the user:
@route('/render')
def render():
return render('index.html')
- Render the HTML to the user as a template with Shake:
@route('/render')
def shake():
return Shake.render('index.html',{'name':'john'})
- Get form data:
@route('/form')
def form(form_data):
name = get_data(form_data,'name')
return f"Hello, {name}!"
- Run the Mango server:
run()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file mango-framework-0.7.8.tar.gz
.
File metadata
- Download URL: mango-framework-0.7.8.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41fb08aec2d931fb92cb59f60a21ae888f824ad65a9ebfcf83f7db023b700846 |
|
MD5 | aaf940fbd5c93b063694ae200c60e3e1 |
|
BLAKE2b-256 | 725e1518fd9498c1b79605abcf21b970faa02f45e1597648a601d5184435da24 |
File details
Details for the file mango_framework-0.7.8-py3-none-any.whl
.
File metadata
- Download URL: mango_framework-0.7.8-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e22ce8aadb46caf910262b9436a281eac5ad87b905f00f4c93dd200584bfcad |
|
MD5 | 1f67584dec2eafe03b5ac62071362c07 |
|
BLAKE2b-256 | 285221b906bdb7ce85c2cd80f47629604f0d925c9be2691a57724445568ea8bf |