MinimalWeb is a Python Web Framework based on WSGI. It's just for ones that like to learn about implementing a web framework from scratch.
You can watch the course behind this framework on youtube from here. videos are in Persian (Farsi) language.
- Install Python v3.9 or later.
- Install virtualenv:
pip insatll virtualenv
- Create a virtual environment:
virtualenv venv
- Active the virtual environment (On UNIX):
source venv/bin/activate
- Install all the requirements by using this command:
pip install -r requirements.txt
from minimalweb import MinimalWeb, TextResponse, HtmlResponse
app = MinimalWeb()
# Render html using Jinja2
@app.route("/")
def index(req):
context = {
"users": ["user1", "user2"]
}
return HtmlResponse("index.html", context=context)
# Using Url Args
@app.route("/user/<string:username>")
def user(req, username):
return TextResponse(f"Hello, {username}")
# Start app
app.run()
- Serving static and dynamic files.
- Adding custom middlewares.
- Running web app without alternative web servers.
Feel free to contribute to this project :)