Build and Deploy a Web Application in 30 Minutes August 23rd, 2012 @kLab Kigali, Rwanda Jeff Hull @jsh2134 github.com/jsh2134
In 30 Minutes we will ● Create an App ● Deploy a Server ● Launch the App Pro Tip: You can fork the finished code here http://github.com/jsh2134/thirty-min-app
Who Are You? ● Buzzient Social CRM and Analytics – Dev Manager and Lead Engineer – 100K Lines of Code, 15 Servers, 24/7 Ops – Recruited and Managed team of 4+ Engineers ● My Ivy Leaguer Test Prep and Tutoring Service – Co-Founder and Lead Developer – Built Tutor/Client CRM software ● Compete.com Web Analytics – Software Developer Intern – Built Ad Scraper that powered their Ad Impact product
No Really, Who Are You? ● I like to Build things (on the Internet) ● The Internet is perfect – For Creation – For Distribution – For Disruption – For Monetization – For Success – For Failure – For LOLcats ●
“Startups are like jumping out of a plane and figuring out how to build the parachute as you fall.” -- Someone Smart
Learn by Experience Write Code ● So you can learn how good/bad it is Share Code ● So someone can tell you how good/bad it is Deploy Code ● So the user can show you how good/bad it is
Best Advice: Just Dive In ● Social Coding – GitHub – StackOverflow ● Courses – Udacity.com – CodeAcademy.com ● Hacker News – http://news.ycombinator.com – Code Tutorials, Startup News, Rants and Raves
The App ● Pure Python ● A Simple Flask App ● Displays Facebook Images matching a word ● Use Twitter Bootstrap for Style ● Use Git for Version Control ● Deploy to Amazon Lets get started...
Friends don't let Friends not use Git ● Git is your friend ● GitHub is your best friend More Octocats at http://octodex.github.com
Lets “git” started $ curl -u 'jsh2134' https://api.github.com/user/repos -d '{"name":"my_repo"}' $ git init my_repo $ cd my_repo $ git remote add origin git@github.com:jsh2134/my_repo $ vim README $ git add README $ git commit -m 'first commit' $ git push origin
What is Flask? ● Lightweight Python web Framework ● Like Django but Simpler – Uses all the best parts ● ~5000 Lines of Code – Can easily dig in if you need to debug or change ● Leverages Jinja and Werkzeug – Werkzeug debugger is incredible
The Simplest Flask App from flask import Flask app = Flask(__name__) @app.route('/') def hello_world(): return 'Hello World!' if __name__ == '__main__': app.run()
And Now Some Flask Code
Jinja Templates ● Separate the Python from the HTML ● Add Logic to your HTML ● Simple Syntax ● Template Inheritance ● Less gray hairs
Pause for Some Jinja Code
Boto ● Python interface to Amazon Web Services ● Create/Start/Stop Servers on Demand – Can do everything actually – Boto is @&$?ing awesome ● Actively Developed ● AWS very Flexible
A Quick Boto Break
Fabric ● Execute commands on remote server ● Installation Scripts ● Update Code ● System Admin Tasks ● We will use Fabric to deploy our app
Fabric Examples
The Final Code Base __init__.py settings.py app.py ec2.py fabfile.py requirements.txt templates/photos.html static/css/bootstrap.css
Deploy the Code
Finito ● Fork this on Github – http://github.com/jsh2134/thirty-min-app ● Contact – @jsh2134 – jsh2134@gmail.com – www.engineerwithoutacause.com ● Slides will be posted online shortly

Build and Deploy a Python Web App to Amazon in 30 Mins

  • 1.
    Build and Deploya Web Application in 30 Minutes August 23rd, 2012 @kLab Kigali, Rwanda Jeff Hull @jsh2134 github.com/jsh2134
  • 2.
    In 30 Minuteswe will ● Create an App ● Deploy a Server ● Launch the App Pro Tip: You can fork the finished code here http://github.com/jsh2134/thirty-min-app
  • 3.
    Who Are You? ● Buzzient Social CRM and Analytics – Dev Manager and Lead Engineer – 100K Lines of Code, 15 Servers, 24/7 Ops – Recruited and Managed team of 4+ Engineers ● My Ivy Leaguer Test Prep and Tutoring Service – Co-Founder and Lead Developer – Built Tutor/Client CRM software ● Compete.com Web Analytics – Software Developer Intern – Built Ad Scraper that powered their Ad Impact product
  • 4.
    No Really, WhoAre You? ● I like to Build things (on the Internet) ● The Internet is perfect – For Creation – For Distribution – For Disruption – For Monetization – For Success – For Failure – For LOLcats ●
  • 5.
    “Startups are likejumping out of a plane and figuring out how to build the parachute as you fall.” -- Someone Smart
  • 6.
    Learn by Experience WriteCode ● So you can learn how good/bad it is Share Code ● So someone can tell you how good/bad it is Deploy Code ● So the user can show you how good/bad it is
  • 7.
    Best Advice: JustDive In ● Social Coding – GitHub – StackOverflow ● Courses – Udacity.com – CodeAcademy.com ● Hacker News – http://news.ycombinator.com – Code Tutorials, Startup News, Rants and Raves
  • 8.
    The App ● Pure Python ● A Simple Flask App ● Displays Facebook Images matching a word ● Use Twitter Bootstrap for Style ● Use Git for Version Control ● Deploy to Amazon Lets get started...
  • 9.
    Friends don't letFriends not use Git ● Git is your friend ● GitHub is your best friend More Octocats at http://octodex.github.com
  • 10.
    Lets “git” started $curl -u 'jsh2134' https://api.github.com/user/repos -d '{"name":"my_repo"}' $ git init my_repo $ cd my_repo $ git remote add origin git@github.com:jsh2134/my_repo $ vim README $ git add README $ git commit -m 'first commit' $ git push origin
  • 11.
    What is Flask? ● Lightweight Python web Framework ● Like Django but Simpler – Uses all the best parts ● ~5000 Lines of Code – Can easily dig in if you need to debug or change ● Leverages Jinja and Werkzeug – Werkzeug debugger is incredible
  • 12.
    The Simplest FlaskApp from flask import Flask app = Flask(__name__) @app.route('/') def hello_world(): return 'Hello World!' if __name__ == '__main__': app.run()
  • 13.
    And Now SomeFlask Code
  • 14.
    Jinja Templates ● Separate the Python from the HTML ● Add Logic to your HTML ● Simple Syntax ● Template Inheritance ● Less gray hairs
  • 15.
    Pause for SomeJinja Code
  • 16.
    Boto ● Python interface to Amazon Web Services ● Create/Start/Stop Servers on Demand – Can do everything actually – Boto is @&$?ing awesome ● Actively Developed ● AWS very Flexible
  • 17.
  • 18.
    Fabric ● Execute commands on remote server ● Installation Scripts ● Update Code ● System Admin Tasks ● We will use Fabric to deploy our app
  • 19.
  • 20.
    The Final CodeBase __init__.py settings.py app.py ec2.py fabfile.py requirements.txt templates/photos.html static/css/bootstrap.css
  • 21.
  • 22.
    Finito ● Fork this on Github – http://github.com/jsh2134/thirty-min-app ● Contact – @jsh2134 – jsh2134@gmail.com – www.engineerwithoutacause.com ● Slides will be posted online shortly