Full-stack_python_web_apps.pdf

70
Full-stack Python Web Applications

Transcript of Full-stack_python_web_apps.pdf

  • Full-stack Python Web Applications

  • Kate Heddleston@heddle317

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

  • What were going to talk about...

    1. A (semi) typical web application2. Dev, staging, production, deploy system3. Helpful python libraries

  • What were not going to talk about...

    Massively scalable web applications. Every single installation on the machine. Nitty gritty details of anything.

  • Web Application

  • Parts of a Stack

    1. Operating System2. Web Server3. Database4. Application Language

  • Web Server

    Apachemod_wsgi

    Application Code

    PythonApplication

    Code

    Python

  • Postgres Database

    Data

  • Web Server

    Apachemod_wsgi

    Application Code

    Python

    Postgres Database

  • Web Server

    Application Code

    Database

  • Web Server

    Nginx/Gunicorn

    Apache/mod_wsgi

  • Application Code

    FrameworksPython libraries

    FrontendStatic Files (maybe)

  • Database

    PostgreSQLMySQL

    SQLServerRedis

    MongoDB

  • Web Server

    Application Code

    Database

    Logging

  • Logging

    Log files on the machine

  • Web Server

    Application Code

    Logging

    Version Control

    Database

  • Version Control

    gitsvn

    GithubBitbucket

  • Web Server

    Application Code

    Logging

    Version Control

    Database

    SMTP Server

  • SMTP Server

    PostmarkAppSendgrid

    Amazon SES

  • Web Server

    Application Code

    Logging

    Version Control

    Database

    SMTP Server

    Data Store

    Async Tasks

  • Async Frameworks

    TwistedTornado

    Async Tasks

    Python-rq/RedisCelery/RabbitMQ

  • Web Server

    Application Code

    Logging

    Version Control

    Database

    SMTP Server

    Data Store

    Async Tasks!ExceptionHandling!

  • !ExceptionHandling!

    Emails

  • Web Server

    Application Code

    Logging

    Version Control

    Database

    SMTP Server

    Data Store

    Async Tasks!ExceptionHandling!

  • Web Server

    Application Code

    Logging

    Version Control

    Database

    SMTP Server

    Data Store

    Async Tasks!ExceptionHandling!

  • Web Server

    Application Code

    Logging

    Version Control

    Database

    SMTP Server

    Data Store

    Async Tasks!ExceptionHandling!

    Cache

  • Cache

    MemcachedRedis

    Varnish

  • Web Server

    Application Code

    Logging

    Database

    Data Store

    Async Tasks!ExceptionHandling!

    Cache

    Monitoring

  • Monitoring

    New RelicNagios

    Pingdom

  • Web Server

    Application Code

    Logging

    Database

    Data Store

    Async Tasks

    !ExceptionHandling!

    Cache

  • Web Server

    Application Code

    Logging

    Database

    Data Store

    Async Tasks!ExceptionHandling!

    Cache

  • !ExceptionHandling!

    EmailsSentry

  • Web Server

    Application Code

    Logging

    Database

    Data Store

    Async Tasks!ExceptionHandling!

    Cache

  • Logging

    Log Server LogglySplunk

  • Web Server

    Application Code

    Logging

    Database

    Data Store

    Async Tasks!ExceptionHandling!

    Cache

  • Web Server Application Code

    Database

    Data Store

    Async Tasks

    Cache

    Web Server Application Code

    Cache

    Load Balancer

  • Logging

    !ExceptionHandling!

    Monitoring

    Version Control SMTP Server

  • Web Server Application

    Code

    Database

    Data Store

    Async Tasks

    Cache

    Load Balancer

    Web Server Application

    CodeCache

    Data Store

    Async Tasks

    Database

    Database

  • System of Systems

  • Production(aka everything you just

    built)

    Dev

    Deploy

  • Dev

    Venv & VenvwrapperVagrant & VirtualBox

  • Deploy

    git pull&

    restartservices

  • Deploy

    Production(aka everything you just

    built)

    Dev

    Testing

  • Testing

    JenkinsCircleCITravisCI

  • DeployProduction

    Dev

    TestingStaging

    Dev Dev

  • Server Config

    ChefPuppetAnsible

    SaltStackDocker

  • Deploy

    ChefPuppetAnsible

    SaltStackDocker

  • Dev

    Venv & VenvwrapperVagrant & VirtualBox

  • DeployProduction

    Dev

    TestingStaging

    Dev Dev

    DeployProduction

    Dev

    TestingStaging

    Dev Dev

  • Hosting

    AWSRackspace

    Linode

  • Chef Repo for a Web Applicationhttps://github.com/heddle317/django-chef-application

  • PaaS

    HerokuElastic Beanstalk

  • Resources Mapshttps://github.com/heddle317/full-stack-resources/tree/master/resources_maps

  • Talk Mapshttps://github.com/heddle317/full-stack-

    resources/tree/master/talk_maps

  • 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.

  • Ask your questions now.

    Kate Heddleston@heddle317

    https://github.com/heddle317/full-stack-resources

  • A complex system that works is invariably found to have evolved from a simple system

    that works. John Gall, Systemantics (1975)

  • A system is never finished being developed until it ceases to be used.

    attributed to Gerald M. Weinberg

  • 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-Exupe ry, Terre des Hommes (1939)

  • There is no such thing as a small change to a large system.

    systems folklore, source lost in the mists of time

  • 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