📜 ⬆️ ⬇️

Django micro

In the comments to the post Django as a Micro-Framework in the blog of Ivan Sagalayev, a certain Andrew Pendleton laid out a great solution for using Django for micro- projects - djmicro .

Inside use example

import djmicro djmicro.configure() from django.shortcuts import render @djmicro.route(r'^$') def hello(request): return render(request, 'index.html', {}) @djmicro.route(r'^test/(\d+)/$') def test(request, id): return render(request, 'test.html', {'id': id}) if __name__ == '__main__': djmicro.run() 

')
And we start it all with the command

 python web.py runserver 


Well, who are interested can get acquainted with the source code
github.com/apendleton/djmicro/blob/master/djmicro.py

Source: https://habr.com/ru/post/139383/


All Articles