$30 off During Our Annual Pro Sale. View Details »

So you want to be a full-stack developer? How to build a full-stack python web application by Kate Heddleston

So you want to be a full-stack developer? How to build a full-stack python web application by Kate Heddleston

PyCon 2014

April 11, 2014
Tweet

More Decks by PyCon 2014

Other Decks in Programming

Transcript

  1. Full-stack Python Web
    Applications

    View Slide

  2. Kate Heddleston
    @heddle317

    View Slide

  3. Python is often one part of a much larger system.

    View Slide

  4. View Slide

  5. What we’re going to talk about...
    1. A (semi) typical web application
    2. Dev, staging, production, deploy system
    3. Helpful python libraries

    View Slide

  6. What we’re not going to talk about...
    ● Massively scalable web applications.
    ● Every single installation on the machine.
    ● Nitty gritty details of anything.

    View Slide

  7. Web Application

    View Slide

  8. Parts of a Stack
    1. Operating System
    2. Web Server
    3. Database
    4. Application Language

    View Slide

  9. Web
    Server
    Apache
    mod_wsgi
    Application
    Code
    Python
    Application
    Code
    Python

    View Slide

  10. Postgres Database
    Data

    View Slide

  11. Web
    Server
    Apache
    mod_wsgi
    Application Code
    Python
    Postgres Database

    View Slide

  12. Web
    Server
    Application
    Code
    Database

    View Slide

  13. Web Server
    Nginx/
    Gunicorn
    Apache/
    mod_wsgi

    View Slide

  14. Application Code
    Frameworks
    Python libraries
    Frontend
    Static Files (maybe)

    View Slide

  15. Database
    PostgreSQL
    MySQL
    SQLServer
    Redis
    MongoDB

    View Slide

  16. Web
    Server
    Application
    Code
    Database
    Logging

    View Slide

  17. Logging
    Log files on the
    machine

    View Slide

  18. Web
    Server
    Application
    Code
    Logging
    Version Control
    Database

    View Slide

  19. Version
    Control
    git
    svn
    Github
    Bitbucket

    View Slide

  20. Web
    Server
    Application
    Code
    Logging
    Version Control
    Database
    SMTP Server

    View Slide

  21. SMTP Server
    PostmarkApp
    Sendgrid
    Amazon SES

    View Slide

  22. Web
    Server
    Application
    Code
    Logging
    Version Control
    Database
    SMTP Server
    Data Store
    Async Tasks

    View Slide

  23. Async Frameworks
    Twisted
    Tornado
    Async Tasks
    Python-rq/Redis
    Celery/RabbitMQ

    View Slide

  24. Web
    Server
    Application
    Code
    Logging
    Version Control
    Database
    SMTP Server
    Data Store
    Async Tasks
    !Exception
    Handling!

    View Slide

  25. !Exception
    Handling!
    Emails

    View Slide

  26. Web
    Server
    Application
    Code
    Logging
    Version Control
    Database
    SMTP Server
    Data Store
    Async Tasks
    !Exception
    Handling!

    View Slide

  27. Web
    Server
    Application
    Code
    Logging
    Version Control
    Database
    SMTP Server
    Data Store
    Async Tasks
    !Exception
    Handling!

    View Slide

  28. Web
    Server
    Application
    Code
    Logging
    Version Control
    Database
    SMTP Server
    Data Store
    Async Tasks
    !Exception
    Handling!
    Cache

    View Slide

  29. Cache
    Memcached
    Redis
    Varnish

    View Slide

  30. Web
    Server
    Application
    Code
    Logging
    Database
    Data Store
    Async Tasks
    !Exception
    Handling!
    Cache
    Monitoring

    View Slide

  31. Monitoring
    New Relic
    Nagios
    Pingdom

    View Slide

  32. Web
    Server
    Application
    Code
    Logging
    Database
    Data Store
    Async Tasks
    !Exception
    Handling!
    Cache

    View Slide

  33. Web
    Server
    Application
    Code
    Logging
    Database
    Data Store
    Async Tasks
    !Exception
    Handling!
    Cache

    View Slide

  34. !Exception
    Handling!
    Emails
    Sentry

    View Slide

  35. Web
    Server
    Application
    Code
    Logging
    Database
    Data Store
    Async Tasks
    !Exception
    Handling!
    Cache

    View Slide

  36. Logging
    Log Server
    Loggly
    Splunk

    View Slide

  37. Web
    Server
    Application
    Code
    Logging
    Database
    Data Store
    Async Tasks
    !Exception
    Handling!
    Cache

    View Slide

  38. Web
    Server
    Application
    Code
    Database
    Data Store
    Async Tasks
    Cache
    Web
    Server
    Application
    Code
    Cache
    Load
    Balancer

    View Slide

  39. Logging
    !Exception
    Handling!
    Monitoring
    Version Control SMTP Server

    View Slide

  40. Web
    Server Application
    Code
    Database
    Data Store
    Async Tasks
    Cache
    Load
    Balancer
    Web
    Server Application
    Code
    Cache
    Data Store
    Async Tasks
    Database
    Database

    View Slide

  41. System of
    Systems

    View Slide

  42. Production
    (aka everything you just
    built)
    Dev
    Deploy

    View Slide

  43. Dev
    Venv & Venvwrapper
    Vagrant & VirtualBox

    View Slide

  44. Deploy
    git pull
    &
    restart
    services

    View Slide

  45. Deploy
    Production
    (aka everything you just
    built)
    Dev
    Testing

    View Slide

  46. Testing
    Jenkins
    CircleCI
    TravisCI

    View Slide

  47. Deploy
    Production
    Dev
    Testing
    Staging
    Dev Dev

    View Slide

  48. Server Config
    Chef
    Puppet
    Ansible
    SaltStack
    Docker

    View Slide

  49. Deploy
    Chef
    Puppet
    Ansible
    SaltStack
    Docker

    View Slide

  50. Dev
    Venv & Venvwrapper
    Vagrant & VirtualBox

    View Slide

  51. Deploy
    Production
    Dev
    Testing
    Staging
    Dev Dev
    Deploy
    Production
    Dev
    Testing
    Staging
    Dev Dev

    View Slide

  52. Hosting
    AWS
    Rackspace
    Linode

    View Slide

  53. Chef Repo for a Web Application
    https://github.com/heddle317/django-chef-application

    View Slide

  54. PaaS
    Heroku
    Elastic Beanstalk

    View Slide

  55. Resources Maps
    https://github.com/heddle317/full-stack-
    resources/tree/master/resources_maps

    View Slide

  56. View Slide

  57. View Slide

  58. View Slide

  59. Talk Maps
    https://github.com/heddle317/full-stack-
    resources/tree/master/talk_maps

    View Slide

  60. View Slide

  61. View Slide

  62. View Slide

  63. View Slide

  64. 3 Takeaways
    ● What are the basic pieces of a full-stack.
    ● What do these pieces look like in different
    environments.
    ● Resources for learning more and working
    with these pieces.

    View Slide

  65. Ask your questions now.
    Kate Heddleston
    @heddle317
    https://github.com/heddle317/full-stack-resources

    View Slide

  66. “A complex system that works is invariably
    found to have evolved from a simple system
    that works.”
    — John Gall, Systemantics (1975)

    View Slide

  67. “A system is never finished being developed
    until it ceases to be used.”
    — attributed to Gerald M. Weinberg

    View Slide

  68. “It is as if perfection be attained not when there is nothing
    more to add, but when there is nothing more to take
    away.”
    — Antoine de Saint-Exupéry, Terre des Hommes (1939)

    View Slide

  69. “There is no such thing as a small change to a
    large system.”
    — systems folklore, source lost in the mists of time

    View Slide

  70. “Everything should be made as simple as
    possible, but no simpler.”
    — commonly attributed to Albert Einstein; it is actually a paraphrase of a
    comment he made in a 1933 lecture at Oxford

    View Slide