Django-Style Flask. Cody Lee SCALE12x Feb 22, git clone

Similar documents
EXPERIENCES MOVING FROM DJANGO TO FLASK

nacelle Documentation

Tomasz Szumlak WFiIS AGH 23/10/2017, Kraków

Django MFA Documentation

Building a Django Twilio Programmable Chat Application

Biffy: The Batteries-Included Flask-based Framework Documentation

29-27 May 2013 CERN WEB FRAMEWORKS. Adrian Mönnich

This video is part of the Microsoft Virtual Academy.

flask-dynamo Documentation

Django IPRestrict Documentation

Building Scalable Web Apps with Python and Google Cloud Platform. Dan Sanderson, April 2015

neo4django Documentation

Rapid Development with Django and App Engine. Guido van Rossum May 28, 2008

wagtail-robots Documentation

Aldryn Installer Documentation

Web-based ios Configuration Management

Django Test Utils Documentation

Python web frameworks

Django File Picker Documentation

Application Authorization with SET ROLE. Aurynn Shaw, Command Prompt, Inc. PGCon 2010

Django urls Django Girls Tutorial

Quick housekeeping Last Two Homeworks Extra Credit for demoing project prototypes Reminder about Project Deadlines/specifics Class on April 12th Resul

django-cas Documentation

Python Schema Generator Documentation

Signals Documentation

Git. all meaningful operations can be expressed in terms of the rebase command. -Linus Torvalds, 2015

Flask Slither Documentation

Gunnery Documentation

Hello, welcome to creating a widget in MyUW. We only have 300 seconds, so let s get going.

Getting Django Set Up Using a Functional Test

open-helpdesk Documentation

Flask Web Development Course Catalog

django-jenkins Documentation

Belle II - Git migration

Django File Picker Documentation

Tangent MicroServices Documentation

Ninja Typers Web Application Design Document By Marvin Farrell C

Without Django. applying django principles to non django projects

django simple pagination Documentation

django-reinhardt Documentation

Hue Application for Big Data Ingestion

django-users2 Documentation

django-idioticon Documentation

django-telegram-bot Documentation

GUIDE TO MAKE A REAL CONTRIBUTION TO AN OPEN SOURCE PROJECT 1. 1

Investigating Source Code Reusability for Android and Blackberry Applications

Lesson 3 Transcript: Part 1 of 2 - Tools & Scripting

django-baton Documentation

Collaborate. w/ ArcGIS Runtime SDK for Android

DIGIT.B4 Big Data PoC

Appointment Scheduling System User Manual. By Grace Web Design

Technology modeling. Ralf Lämmel Software Languages Team University of Koblenz-Landau

Data Warehouse: User Computer Configuration Guide

Security. CSC309 TA: Sukwon Oh

Enter the site Title: Student Name s eportfolio Choose your Website Domain: Use a Subdomain of Weebly.com

Reminders. Full Django products are due next Thursday! CS370, Günay (Emory) Spring / 6

About the Tutorial. Audience. Prerequisites. Disclaimer & Copyright. TurboGears

DJOAuth2 Documentation

DBNsim. Giorgio Giuffrè. 0 Abstract How to run it on your machine How to contribute... 2

django-waffle Documentation

django-oscar-paypal Documentation

pydrill Documentation

Linux System Management with Puppet, Gitlab, and R10k. Scott Nolin, SSEC Technical Computing 22 June 2017

2 Initialize a git repository on your machine, add a README file, commit and push

django-stored-messages Documentation

School of Computing Science Gitlab Platform - User Notes

Pragmatic Guide to Git

Monitoring Tool Made to Measure for SharePoint Admins. By Stacy Simpkins

invenio-formatter Documentation

CID Documentation. Release Francis Reyes

django-private-chat Documentation

web.py Tutorial Tom Kelliher, CS 317 This tutorial is the tutorial from the web.py web site, with a few revisions for our local environment.

Overview of BC Learning Network SMS2 Introduction

nucleon Documentation

django-scaffold Documentation

PROGRAMMING GOOGLE APP ENGINE WITH PYTHON: BUILD AND RUN SCALABLE PYTHON APPS ON GOOGLE'S INFRASTRUCTURE BY DAN SANDERSON

Git GitHub & secrets

Flash MP3 Player DMXzone.com Flash MP3 Player Manual

Software Test Plan Version 1.0

Python simple arp table reader Documentation

Flask-Sitemap Documentation

DJANGO THE PYTHON WEB FRAMEWORK

Full Stack Web Developer Nanodegree Syllabus

Bishop Blanchet Intranet Documentation

DISQUS. Continuous Deployment Everything. David

Created by: Nicolas Melillo 4/2/2017 Elastic Beanstalk Free Tier Deployment Instructions 2017

Intro to Couchbase Server for ColdFusion - Clustered NoSQL and Caching at its Finest

Bambu API Documentation

Tutorial: Getting Started with Git. Introduction to version control Benefits of using Git Basic commands Workflow

Django Groups Manager Documentation

Online. Course Packet PYTHON MEAN.NET

Make the switch. Seamlessly migrate your ios devices from an existing MDM provider to Mobile Guardian, using our helpful migration guide.

Lab 01 How to Survive & Introduction to Git. Web Programming DataLab, CS, NTHU

django-baton Documentation

Technical Note: On The Usage and Development of the AWAKE Web Server and Web Applications

Moving to a Sustainable Web Development Environment for Library Web Applications

Assumptions. GIT Commands. OS Commands

About the Tutorial. Audience. Prerequisites. Disclaimer & Copyright. Django

Scaling DreamFactory

Create-A-Page Design Documentation

Transcription:

Django-Style Flask Cody Lee codylee@wellaware.us git clone https://github.com/platinummonkey/flask_scale12x.git SCALE12x Feb 22, 2014

Introduction Senior Network Engineer at WellAware - An oil and gas SaaS and network communications company Conference Chairman for the annual Texas Linux Festival Come check us out June 13-14 in Austin, TX! http://texaslinuxfest.org for more information Yes, I m really a Mechanical Engineer Bachelors of Science in Mechanical Engineering at Texas A&M University Master s student at University of Texas at San Antonio

Outline 1 Get Prepared 2 Flask and Django Django Flask Side-By-Side 3 What We Care About Sugar Cube 4 Wrap it All Up 5 Questions

Get Prepared Get Prepared git clone https://github.com/platinummonkey/flask_scale12x.git Run the viewer setup.sh script to setup the helper scripts. (Optional*) Setup and Start Titan: run setup titan.sh and start titan.sh. (Optional*) Setup virtualenv: mkvirtualenv -a <repo_root> \ -r <repo_root>/requirements.pip \ flask_scale12x Utilize talk helper.sh during the talk to switch between commits easily.

Flask and Django Django Django Batteries Included Early Framework led to early adoption Monolithic approach Organization - Everything is an app Url importing and view routing Models - ORM with DB Managers for use with RDBs Admin Builtins Auth & Permissions Testing Configuration Documentation Templating Extensions Django-NoSQL project - for use with NoSQL DBs [however its just an adapter]

Flask and Django Flask Flask Flexible by Design No forced organization pattern URL routing happens at the View Definition Documentation Great but could be better Version docs are not separated, but noted explicitly within the latest docs. Templating Request object is implicitly context aware Jinja2 Done right - Doesn t unecessarily limit programmer Run python code and use callables Extensions Auth - Flask-Login Permissions - Flask-Principal (if simple enough) Configuration - Flask-Environment Testing - Flask-Testing

Flask and Django Side-By-Side Flask and Django Side-by-Side Django Batteries Included Forced Organization Pattern Monolithic approach Url importing and view routing ORM Many Builtins Great Documentation Okay Templating Extensions available Flask No Batteries No forced organization pattern Modular approach URL routing happens at the View Definition No ORM forced Minimal Builtins Good Documentation Better Templating Extensions usually required

What We Care About What was really nice to have? Organization Global Application Context Configuration URL and View Routing ORM & Models Auth & Sessions Testing Permissions

Sugar Cube Organization This where you get to decide how everything gets laid out! Let s just go with Django s everything is an app approach for this context. Feel free to do anything sensible (or not). <project root> app.py, models.py, requirements.pip, server.py, shell.py, urls.py, version.py, views.py auth init.py, decorators.py, models.py, urls.py, views.py permissions init.py, decorators.py, permissions.py tests... config init.py, base.py, development.py, production.py, staging.py tools apps.py, constants.py, login manager.py, url tools.py, sessions.py,...

Sugar Cube Global Application Context The main app.py! Pretty common method, with a very slight twist TO THE CODE! 683e32dd75361d4f87687b4f2235de8af455b950

Sugar Cube Configuration Flask-Environments Utilize FLASK ENVIRONMENT environment variable TO THE CODE! 028b31d21435954cb2579a6e780d579f6d599c00

Sugar Cube URL and View Routing Here is where things get sugary. How does Django do it? How do we want it? INSTALLED APPS tooling TO THE CODE! ba95b15727bd4f543e907e4e12d06112d750168f

Sugar Cube ORM & Models Pick a Database (SQL, NoSQL, Graph, Key-Value,...) Hope that it has a sane ORM, if not... CREATE ONE! (challengeaccepted) We ll use bulbs (a really cool OGM) and factory boy How do we want to integrate it! Just the same way! Utilize INSTALLED APPS loader TO THE CODE! a3ca56d346731b9ca953f0c08fda3fb99325d353

Sugar Cube Auth & Sessions Auth and sessions are built-in to Django, not so much in Flask Create or own auth app and models Implement Authentication with Flask-Login and Flask-Cache! TO THE CODE! 66c2c5b14e52584892d1a28a9dd33f112d57591c

Sugar Cube Testing Django has a TestRunner built-in - creates test database and... Flask doesn t We still have nose! We also have Flask-Testing! TO THE CODE! 66c2c5b14e52584892d1a28a9dd33f112d57591c

Sugar Cube Permissions Permisisons are built-in to Django (Though Guardian is way better) Create our own or use Flask-Prinicpal Preview available in code 66c2c5b14e52584892d1a28a9dd33f112d57591c

Wrap it All Up Wrapping it All Up Whoa! This looks and feels sorta like Django! What we ve done today: Organization Global Application Context Configuration URL and View Routing ORM & Models Auth & Sessions Testing Permissions

Questions Questions? Comments? Please just wake up.