You are on page 1of 17

Python for Web Dev

Luis Borbon
16/September/2016
Agenda

1. Python language
2. Python Chain
3. Web frameworks
4. The basics
5. Questions
6. References
1. Python Language

Python is a high-level, structured, open-


source programming language that can
be used for a wide variety of
programming tasks.

Python was created by Guido Van


Rossum in the early 1990s.
1.1. Python Features
● Simple
● Easy to Learn
● Free and Open Source
● High-level Language
● Portable
● Interpreted
● Object Oriented
1.2. The Zen of Python
● Beautiful is better than ugly.
● Explicit is better than implicit.
● Simple is better than complex.
● In the face of ambiguity, refuse the temptation
to guess.
● Now is better than never.
● If the implementation is easy to explain, it may
be a good idea.
1.3. Popularity of Coding Languages

Source: codingdojo.com

Source: codeeval.com

Source: PopularitY
1.4. Python on the Academy
1.5. Speed Benchmarking

Source: Udemy
2. Python Chain

Analytics Development DevOps


● Numpy ● django ● Ansible
● SciPy ● flask ● Fabric
● Pandas ● Salt
● Scikit Learn ● AWS Lambda
● Jupyter
3. Web Frameworks
● URL routing
● HTML, XML, JSON, and other output format
templating
● Database manipulation
● Security against Cross-site request forgery
(CSRF) and other attacks
● Session storage and retrieval
3.1. On Production

YouTube Bitbucket Pinterest


Yahoo Maps Instagram Instagram
SurveyMonkey NASA Spotify
Google Firefox Rdio
Bitly Prezi Disqus
Reddit Evenbrite Washington Post
3.2. Popular Web Frameworks
● Django
○ Bitbucket, Pinterest, Instagram, and
The Onion

● Pyramid
○ Dropbox, Fedora

● Flask
3.3. Web Frameworks Comparison
● Django is best for:
○ Developers who aim to include all the batteries a web application will need.
○ Developers who wants to use ORM, templating, routing, authentication, database administration
and bootstrapping on the go

● Pyramid is best for:


○ Developers working on API projects
○ Prototyping a concept
○ Developing large web applications, such as a CMS

● Flask is best for:


○ Developers who care about best practices
○ Developers who want to prototype something quickly
○ Developers who need a standalone app
4. The Basics
$ python
>>> print("Hello World!")
Hello World!

On this link https://python.swaroopch.com/basics.html check:


● Indentation
● Control Flow
● Functions
4.1. Simple web framework example
Flask django

$ pip install Flask


$ python app.py
* Running on http://localhost:5000/

from flask import Flask django-admin startproject hello_django


django-admin startapp howdy
app = Flask(__name__)
hello_django
├── hello_django
@app.route("/") │ ├── settings.py
def hello(): │ ├── urls.py
│ └── wsgi.py
return "Hello World!" ├── howdy
│ ├── admin.py
│ ├── migrations
if __name__ == "__main__": │ ├── models.py
app.run() │ ├── tests.py
│ └── views.py
└── manage.py
5. Questions
6. References
Python popular languages
http://blog.codeeval.com/codeevalblog/2016/2/2/most-popular-coding-languages-of-2016

Python web frameworks


https://www.airpair.com/python/posts/django-flask-pyramid

PHP, Python and Ruby comparison


https://blog.udemy.com/wp-content/uploads/2012/01/PROGRAMMING-LANGUAGE-3.png

You might also like