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

PHP Addiction - or, teach someone about python

PHP Addiction - or, teach someone about python

A talk given at PyCon ZA about some of the rougher aspects of the user experience of someone coming from a PHP background, learning about Python/Django. Video here - http://www.youtube.com/watch?v=_9nM1SpBp4w

E85644104e56d9f8be2fcea8b20f5e97?s=128

Bradley Whittington

October 05, 2012
Tweet

More Decks by Bradley Whittington

Other Decks in Programming

Transcript

  1. PHP addiction or, teach someone about python

  2. Bradley Whittington @darb / bradley@motribe.com http://github.com/bradwhittington (PHP) Dev / Ops

    manager at Motribe, a Mxit company (Python) Technical co-founder of Lessfuss
  3. “This would be easier in python” - that guy

  4. But... PHP is fine, for us.

  5. '0' == 0 Yes. That. Just. Happened.

  6. I grew up on PHP. It has paid lots of

    rent.
  7. HelloWorld.php: apt-get install apache2 php-5 echo "<?php phpinfo() ?>" >

    /var/www/index.php Open browser to http://localhost
  8. Let there be blog wget http://wordpress.org/latest.zip unzip ...

  9. Let's get all fancy Drupal, Symfony2, Code Ignitor, etc. etc.

    PHP packaging is matur{e,ing} too.
  10. Put it on the Internet

  11. I said plethora.

  12. This would be easier in python?

  13. “But, PHP is terrible.” - that guy

  14. “PHP: a fractal of bad design” http://goo.gl/vMtqz

  15. None
  16. “Just Install Python.” - that guy

  17. None
  18. Wut?

  19. I kid. Default on OSX, Linux LOL, Windows.

  20. “Just learn python” - that guy

  21. None
  22. I kid http://learnpythonthehardway.org/ http://codecademy.com/tracks/python http://www.udacity.com/overview/Course/cs101/Course Rev/apr2012

  23. I wanted to make a internet website.

  24. "HOWTO Use Python in the web" http://docs.python.org/howto/webservers.html

  25. None
  26. Wut.

  27. “Just learn Django” - zZzzZZzz

  28. None
  29. I did the tutorial, tell me more

  30. Djangobook! Django Version 1.0. After the magic was removed. In

    2009. Erk.
  31. Let's poke around

  32. (test)vagrant@lucid32:fubar$ wc -l settings.py 151 (test)vagrant@lucid32:django$ find .|grep py$|wc -l

    997
  33. None
  34. Just learn Flask|Bottle|Pyramid

  35. Back to Django

  36. Django HelloWorld (Ghetto style): $ vim urls.py from django.conf.urls import

    patterns, include, url from django.http import HttpResponse def hello(request): return HttpResponse('Ohai') urlpatterns = patterns('', (r'^$', hello), ) :wq $ ./manage.py runserver ... $ xdg-open http://localhost:8000
  37. Let's show the world.

  38. None
  39. Huh.

  40. daemonize your mod_wsgi process in apache Or gunicorn it. Or

    uWSGI. You cray if you mod_python, bro. ♬♫♬♫ Don't forget your static files. ♫♪♬♫
  41. Sure, it's no “Just rake your passenger and phusion your

    apache gem”
  42. But, install your requirements file under a virtualenv. Buddy. Cos,

    you know, http://www.12factor.net/
  43. Huh.

  44. Fine, just use: Heroku | Gondor | Openshift | zzZzzZz

    While you cut your teeth. You'll need git | hg | zzzz too Cos, http://www.12factor.net/
  45. Nobody said it was gonna be easy.

  46. Thanks? @darb http://github.com/bradwhittington