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

Agile web dev with Pyhon

Keith Yang
January 13, 2013

Agile web dev with Pyhon

A presentation for WebConf Taiwan 2013

Keith Yang

January 13, 2013
Tweet

More Decks by Keith Yang

Other Decks in Technology

Transcript

  1. Agile web dev with Python a presentation by Keith Yang

    for WebConf Taiwan 2013 @keitheis http://quest.keitheis.org/
  2. WebConf.TW 2013 How to learn Python from zero to web

    development? A question on programmers.stackexchange.com
  3. WebConf.TW 2013 How to learn Python from zero to web

    development? A question on programmers.stackexchange.com
  4. WebConf.TW 2013 How to learn Python from zero to web

    development? A question on programmers.stackexchange.com Just go over 14 tutorials.
  5. WebConf.TW 2013 Choosing good... • Language • Framework • Library

    • Application • Methodology • Architecture • Team • Organization
  6. WebConf.TW 2013 >>> assert True and False Traceback (most recent

    call last): File "<stdin>", line 1, in <module> AssertionError Traceback (most recent call last): File "<stdin>", line 1, in <module> AssertionError
  7. WebConf.TW 2013 >>> assert True and False Traceback (most recent

    call last): File "<stdin>", line 1, in <module> AssertionError Traceback (most recent call last): File "<stdin>", line 1, in <module> AssertionError raise Exception quickly.
  8. WebConf.TW 2013 Exception You can choose not to raise it

    now, you will be !ne except it may come to visit you often, sometimes secretly.
  9. WebConf.TW 2013 Keith Yang architect.py at biideal yet another di"erent

    e-commerce provider Taipei.py organizer PyCon Taiwan sta"
  10. WebConf.TW 2013 Keith Yang architect.py at biideal yet another di"erent

    e-commerce provider Taipei.py organizer PyCon Taiwan sta" 2012 2013 ...
  11. WebConf.TW 2013 We’re using Python And not just us. Python

    has been popular in parts of the startups
  12. WebConf.TW 2013 We’re using Python And not just us. Python

    has been popular in parts of the startups Instagram, FriendFeed, ... how Facebook [like] it
  13. WebConf.TW 2013 Python is good by people who is using

    it be careful with magic project that supports injection of apps, plugins, extensions
  14. WebConf.TW 2013 Web Frameworks of Python ... lots • Django

    • Pyramid • Flask • Tornado • Web2py, Turbogears, bottle.py, ...
  15. WebConf.TW 2013 Web Frameworks of Python ... lots • Django

    • Pyramid • Flask • Tornado • Web2py, Turbogears, bottle.py, ... ALL AGILE!
  16. WebConf.TW 2013 Web Frameworks of Python ... lots • Django

    • Pyramid • Flask • Tornado • Web2py, Turbogears, bottle.py, ... ALL AGILE! Ready for RESTful
  17. WebConf.TW 2013 As long as you know PEP 8 or

    The Hitchhiker’s Guide to Python!
  18. WebConf.TW 2013 As long as you know PEP 8 or

    The Hitchhiker’s Guide to Python! Good style to follow
  19. WebConf.TW 2013 It’s important You can make choice between several

    well developed choices. Not just ONE there.
  20. WebConf.TW 2013 How to pick a web framework from “Just

    pick a good one.” to “I’ve compared EVERYTHING.”
  21. WebConf.TW 2013 How to pick a web framework Goal: Blog,

    Wiki, EC Platform Scale: Personal, Studio, Company, Enterprise Resources: Schedule, Support
  22. WebConf.TW 2013 How to pick a web framework Micro: bottle.py

    Mini: Flask by Armin Ronacher by Marcel Hellkamp
  23. WebConf.TW 2013 How to pick a web framework Micro: bottle.py

    Mini: Flask Middle: Django, Pyramid, web2py by Armin Ronacher by Marcel Hellkamp
  24. WebConf.TW 2013 How to pick a web framework Micro: bottle.py

    Mini: Flask Middle: Django, Pyramid, web2py Other: you’ll know what you want. by Armin Ronacher by Marcel Hellkamp
  25. WebConf.TW 2013 What Makes Pyramid Unique Single-!le applications Decorator-based con!g

    URL generation Debug Toolbar Add-ons Class-based and function-based views Asset speci!cations Extensible templating Event system No any “mutable globals” Transaction management
  26. WebConf.TW 2013 What Makes Pyramid Unique Single-!le applications Decorator-based con!g

    URL generation Debug Toolbar Add-ons Class-based and function-based views Asset speci!cations Extensible templating Event system No any “mutable globals” Transaction management Lots more!
  27. WebConf.TW 2013 Object-Relational Mapping •SQLAlchemy unless you’re using Django ORM

    or web2py DAL • You might also be interested in: MongoKit structured schema and validation layer
  28. WebConf.TW 2013 Template •Mako or Jinja2 unless you’re using Django

    Template • You might also be interested in: Plim “a Python port of Ruby’s Slim template language built on top of the Mako Templates”
  29. WebConf.TW 2013 Manage Web Assets “webassets - Asset management for

    Python” • with Django • with Flask • with Pyramid • other or no framework
  30. WebConf.TW 2013 Testing •Nosetests (Django-nose?) • You might also be

    interested in: pytest more powerful, detail, #exible and complex
  31. WebConf.TW 2013 Coding tool •Sublime Text 2 powered by Python

    •PyDev more powerful, detail, #exible and complex • Lots... Emacs, Vim, ...
  32. WebConf.TW 2013 Coding tool •Sublime Text 2 powered by Python

    •PyDev more powerful, detail, #exible and complex • Lots... Emacs, Vim, ...
  33. WebConf.TW 2013 Deployment •Fabric + cuisine Server(s) administration in Python

    • You might also be interested in: Plumbum di"erent style... # sudo[ls["-l", "-a"]] by Christian Vest Hansen and Jeffrey E. Forcier. by Sebastien Pierre by Tomer Filiba
  34. WebConf.TW 2013 Fabric + cuisine def restart_service(service_name, time_interval=1): stop_service(service_name) time.sleep(time_interval)

    # Avoid time attack start_service(service_name) def stop_service(service_name): return sudo( 'service {service_name} stop'.format( service_name=service_name)) def start_service(service_name): return sudo( 'service {service_name} start'.format( service_name=service_name))
  35. WebConf.TW 2013 Process Management •Supervisor monitor and control a number

    of processes on UNIX-like operating systems. • You might also be interested in: Circus.io process & socket manager. by Agendaless by Mozilla
  36. WebConf.TW 2013 Powerful Data Computing If you’re going to have

    numbers, you won’t hope to learn one more language for statistic and analysis.
  37. WebConf.TW 2013 Python User Group in Taiwan Communities: PyHUG #

     Taipei.py #  Yilan, Tainan, Kaohsiung, Kinmen, ... #
  38. WebConf.TW 2013 PyCon Taiwan 2013 after PyCon.TW 2012 fantasy #

     Call for Proposals and Sponsorship tw.pycon.org
  39. WebConf.TW 2013 Some Fun Demo? % python Python 2.7.2 (default,

    Jun 20 2012, 16:23:33) Type "help", "copyright", "credits" or "license" for more information. >>> import this