pywsgiapp is a lightweight WSGI application framework aimed at simplifying the development of WSGI-based web applications. It offers an intuitive interface for managing HTTP requests and responses, enabling easy creation and deployment of web applications.
- Lightweight and easy-to-use WSGI framework.
- Customizable request handler for processing HTTP requests.
- Compatible with WSGI servers like
gunicorn.
To install the package, use the following command:
pip install pywsgiappHere’s an example of how to use pywsgiapp to create a simple WSGI application:
from pywsgiapp.WSGIApp import createWSGIApp
# Define a request handler function
def requestHandler(url: str, requestHeaders: dict, postData: dict) -> dict:
response_body = f"Received URL: {url}, Headers: {requestHeaders}, Post Data: {postData}"
return {
"responseCode": 200,
"responseHeaders": {"Content-Type": "text/plain"},
"responseBody": response_body
}
# Create the WSGI application
app = createWSGIApp(requestHandler)Save this code in a file (e.g., basic.py) and run it with a WSGI server like gunicorn:
gunicorn basic:appFor more examples, see the Examples Documentation.
pywsgiapp/: The main package containing the framework code.examples/: Example scripts demonstrating how to use the framework.setup.py: Metadata and installation configuration.requirements.txt: List of dependencies for development and deployment.
If you want to contribute or modify the framework, follow these steps:
-
Clone the repository:
git clone https://github.com/jaythorat/pywsgiapp.git cd pywsgiapp -
Install the package in editable mode:
pip install -e .
The framework requires the following dependencies:
gunicorn>=20.1.0
Install them using:
pip install -r requirements.txtThis project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! If you’d like to contribute, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Commit your changes and push the branch.
- Open a pull request.
For any questions or issues, feel free to contact the author:
- Author: Jay Thorat
- Email: dev.jaythorat@gmail.com
- GitHub: jaythorat
- Portfolio: portfolio.jaythorat.in