My own WSGI micro web framework, currently under development.
Mokka is a delicate, experimental WSGI micro web framework, for
building minimalistic python web applications. It is still under development and is open to contributions. It is built on
top of a WSGI helper library, called Werkzeug and uses
TRender templating engine, to render user created templates.
This project will soon be published on PyPI, to make installations easy with ‘pip’. Until then
installations have to be done manually:
cd
into the root of this repo and install the dependencies using the bash
pip install -r requirements.txt
import sys
sys.path.append('path/to/this/repo/on/your/machine')
Assuming you have installed the package:
from mokka import Mokka, Router
app = Mokka()
with Router('/') as vb:
def hello(req):
return "Hello world!!"
vb.bind(fun)
if __name__ == '__main__':
from werkzeug.serving import run_simple
run_simple('localhost', 4000, app)
Let’s see step by step of what’s happening here:
if __name__ == '__main__':
we import a simple development server from werkzeug and we pass in the app instance.Now I’ll talk in direct speech. I’m a student who’s still learning whatever he can and doing his best to showcase his
skills. I had a great amount of curiosity over these web applications and how they work, how they interact with web
servers etc. And after spending my time pondering, I decided to take up this project and build my own framework, not
to come up with something better than what is already there, but to learn what actually happens under the hood.
That gives me knowledge and knowlegde is power. This simple quote made me do it:
‘I see, and I forget. I hear, and I remember. I do, and I understand’
I’ll be sure to include my journey in the docs too. Stay tuned!