Async (ASGI) Python web framework
Project description
Backendpy
Python web framework for building the backend of your project!
Some features:
- Asynchronous programming (ASGI-based projects)
- Application-based architecture and the ability to install third-party applications in a project
- Support of middlewares for different layers such as Application, Handler, Request or Response
- Supports events and hooks
- Data handler classes, including validators and filters to automatically apply to request input data
- Supports a variety of responses including JSON, HTML, file and… with various settings such as stream, gzip and…
- Router with the ability to define urls as Python decorator or as separate files
- Application-specific error codes
- Optional default database layer by the Sqlalchemy async ORM with management of sessions for the scope of each request
- Optional default templating layer by the Jinja template engine
- …
Requirements
Python 3.8+
Documentation
Documentation is available at https://backendpy.readthedocs.io.
Quick Start
Installation
$ pip3 install backendpy
Or use the following command to install optional additional libraries:
$ pip3 install backendpy[full]
You also need to install an ASGI server such as Uvicorn, Hypercorn or Daphne:
$ pip3 install uvicorn
Create Project
project/main.py
from backendpy import Backendpy
bp = Backendpy()
Create Application
project/apps/hello/main.py
from backendpy.app import App
from .handlers import routes
app = App(
routes=[routes])
project/apps/hello/handlers.py
from backendpy.router import Routes
from backendpy.response import Text
routes = Routes()
@routes.get('/hello-world')
async def hello(request):
return Text('Hello World!')
Activate Application
project/config.ini
[networking]
allowed_hosts =
127.0.0.1:8000
[apps]
active =
project.apps.hello
Run Project
Inside the project root path:
$ uvicorn main:bp
Command line
The basic structure of a project mentioned above can also be created by commands:
$ backendpy create_project --name myproject
To create a project with more complete sample components:
$ backendpy create_project --name myproject --full
Or to create an application:
$ backendpy create_app --name myapp
$ backendpy create_app --name myapp --full
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
backendpy-0.2.5a4.tar.gz
(38.4 kB
view hashes)
Built Distribution
Close
Hashes for backendpy-0.2.5a4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31d4cf236844ee99e14c8066b6787e34e348fc2aeebc766be83ac4b426ad922b |
|
MD5 | 2d47b8edfaaf578fc5afe6844a90f922 |
|
BLAKE2b-256 | bd33d6c8c8adc9cd62d2efe31314ca182147c7a848c91535d4656c6a4e163d10 |