Slide 1

Slide 1 text

PHP addiction or, teach someone about python

Slide 2

Slide 2 text

Bradley Whittington @darb / [email protected] http://github.com/bradwhittington (PHP) Dev / Ops manager at Motribe, a Mxit company (Python) Technical co-founder of Lessfuss

Slide 3

Slide 3 text

“This would be easier in python” - that guy

Slide 4

Slide 4 text

But... PHP is fine, for us.

Slide 5

Slide 5 text

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

Slide 6

Slide 6 text

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

Slide 7

Slide 7 text

HelloWorld.php: apt-get install apache2 php-5 echo "" > /var/www/index.php Open browser to http://localhost

Slide 8

Slide 8 text

Let there be blog wget http://wordpress.org/latest.zip unzip ...

Slide 9

Slide 9 text

Let's get all fancy Drupal, Symfony2, Code Ignitor, etc. etc. PHP packaging is matur{e,ing} too.

Slide 10

Slide 10 text

Put it on the Internet

Slide 11

Slide 11 text

I said plethora.

Slide 12

Slide 12 text

This would be easier in python?

Slide 13

Slide 13 text

“But, PHP is terrible.” - that guy

Slide 14

Slide 14 text

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

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

“Just Install Python.” - that guy

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

Wut?

Slide 19

Slide 19 text

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

Slide 20

Slide 20 text

“Just learn python” - that guy

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

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

Slide 23

Slide 23 text

I wanted to make a internet website.

Slide 24

Slide 24 text

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

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

Wut.

Slide 27

Slide 27 text

“Just learn Django” - zZzzZZzz

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

I did the tutorial, tell me more

Slide 30

Slide 30 text

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

Slide 31

Slide 31 text

Let's poke around

Slide 32

Slide 32 text

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

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

Just learn Flask|Bottle|Pyramid

Slide 35

Slide 35 text

Back to Django

Slide 36

Slide 36 text

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

Slide 37

Slide 37 text

Let's show the world.

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

Huh.

Slide 40

Slide 40 text

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. ♫♪♬♫

Slide 41

Slide 41 text

Sure, it's no “Just rake your passenger and phusion your apache gem”

Slide 42

Slide 42 text

But, install your requirements file under a virtualenv. Buddy. Cos, you know, http://www.12factor.net/

Slide 43

Slide 43 text

Huh.

Slide 44

Slide 44 text

Fine, just use: Heroku | Gondor | Openshift | zzZzzZz While you cut your teeth. You'll need git | hg | zzzz too Cos, http://www.12factor.net/

Slide 45

Slide 45 text

Nobody said it was gonna be easy.

Slide 46

Slide 46 text

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