Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Django - best Python micro web framework

Django - best Python micro web framework

There are more Python "micro" web frameworks than you can count: Flask, Bottle, Pyramid, Tornado, web.py are some examples. Django is too strict and heavy from all extraneous lines of code to successfully compete with all of them. Is it? I will show you that Django is the best micro web framework!

4885da39b4bc6628c5599eb9253dcf32?s=128

Marek Stępniowski

July 14, 2014
Tweet

Transcript

  1. micro web frameworks pl. mikrołebfrejmłorki in

  2. mikrołebfrejmłorki

  3. mikrołebfrejmłorki

  4. • HTTP • routing • templates • configuration • ORM

    web framework we
  5. • HTTP • routing • templates • configuration • ORM

    web framework but
  6. • few lines of code • few dependencies • small

    memory footprint • application in a single file • framework in a single file „micro” web framework additional
  7. • few lines of code • few dependencies • small

    memory footprint • application in a single file • framework in a single file „micro” web framework this
  8. „micro” web framework • Flask • Bottle • web.py single

  9. „micro” web framework • Flask • Bottle • web.py •

    Django single
  10. „micro” web framework • Flask • Bottle • web.py •

    Django 5922 2722 6610 72790 lines
  11. „micro” web framework • Flask • Bottle • web.py •

    Django 2132 2722 6575 69399 3790 0 35 3391 test
  12. # ls django ! bin conf contrib core db dispatch

    forms http middleware shortcuts template templatetags test utils views what
  13. „micro” web framework • Flask • Bottle • web.py •

    Django 2132 2722 6575 24731 3790 0 35 3391 0 0 0 44668 test
  14. # Flask? ! itsdangerous markupsafe werkzeug jinja2 but

  15. „micro” web framework • Flask • Bottle • web.py •

    Django 20124 2722 6575 24731 3790 0 35 3391 0 0 0 44668 17992 0 0 0 test
  16. app in a single file? Django

  17. from django.conf import settings ! if not settings.configured: settings.configure(DEBUG=True, DATABASES={},

    ROOT_URLCONF='app', INSTALLED_APPS=[], MIDDLEWARE_CLASSES=[], TEMPLATE_DIRS=['templates']) put
  18. from django.core.wsgi import get_wsgi_application application = get_wsgi_application() ! if __name__

    == "__main__": import sys from django.core import management management.execute_from_command_line(sys.argv) create
  19. from django.core.wsgi import get_wsgi_application application = get_wsgi_application() ! if __name__

    == "__main__": import sys from django.core import management management.execute_from_command_line(sys.argv) NOTE:
  20. 56 LOC 17 Django „boilerplate”,

  21. • few lines of code ✔ • few dependencies ✔

    • small memory footprint ✔ • application in a single file ✔ • framework in a single file „micro” web framework look
  22. Django == best \ mikrołebfrejmłork

  23. Marek  Stępniowski @mstepniowski