Guide


A Guide to Python for Web Development

By Liz Eggleston
Last Updated December 7, 2021

Python is a popular language used in data science, machine learning, scripting, and cybersecurity, but it’s also a powerful language used by web developers to build huge web applications like Spotify and Dropbox. We asked Joel Carter from the Python bootcamp Coding Temple to share his expertise about why you would choose Python over Ruby or JavaScript, the 5 most popular Python libraries, and how to use Anaconda to get started as a Python developer.

Meet the Expert: Joel Carter

  • Joel has been tinkering with computers since kindergarten! He worked in various tech jobs from Help Desk to Web Development for a few years after college before starting as an instructor for Coding Temple.

  • Joel now works as the Director of Curriculum at Coding Temple where he manages the Python-based curriculum and provides support for instructors.

What is Python?

Python is a high-level programming language. Python is an object-oriented language, meaning that code is grouped together and treated as an individual unit that can interact with other objects. While Python is used by many people for web development, it has plenty of other uses in data science, machine learning, and cybersecurity.

Pro-Tip: High-Level vs Low-Level Programming

“High Level” means the language is a few steps removed from the bare metal of the computer. This is different from languages like C++ and Fortran which use compilers. 

Imagine that someone travels to a foreign country like Spain, but doesn’t speak a local language. 

  • If you go to Spain and learn to speak Spanish, then you can communicate with locals easily and get everything done with less effort. This is similar to compiled languages like C++, which communicate directly to the computer.
  • Python is more similar to a tourist going to Spain and bringing along a translator to communicate with locals. 

How is Python Used by Web Developers?

Python is a programming language widely used by web developers, most often to build out the back end (or server-side) of a web application. The back-end generally includes the servers that run the website as well as the databases that store information. Python is used alongside other back-end languages to build the portions of websites that users don’t see while browsing.

While Python remains a popular option for web development, it’s far from the only language you’ll need to develop an application. Python is high-level and heavy lifting, which makes it extremely useful for building large-scale projects. 

Why would you choose Python over other web languages like Rails or JavaScript?

We’ve chosen to teach Python at Coding Temple because it’s popular in the job market and it’s a great first programming language. There are several reasons Python remains a popular choice for web developers:

  1. Ease of Use – Python is a good first language to learn because it’s easy to get something up and running and to see immediate results from your hard work. Burnout is inevitable at some point when learning a language, but Python can help to alleviate some of that with its ease of use.
  2. Versatility – Python is not the only Object Oriented Programming language, so if you learn how it works, then you can transfer the same knowledge to other languages like Ruby on Rails.
  3. Python Libraries – In Python, there is a wide range of libraries already available for developers to use, which is one of the reasons it’s preferred over other languages. Developers frequently use Python web frameworks and libraries to write code that interacts with databases and servers.

The good news is that once you’re familiar with how programming languages work, it’s much easier to pick up new ones! Learning Python is similar to learning English before learning Spanish or French. There are similarities, but you’ll still need to learn new conjugations. The same is true for programming and Python can easily translate into Java, JavaScript, or Ruby but the syntax will be harder to figure out.

The Top Python Libraries for Web Development

  • Flask- Flask is a lightweight microframework used for web development. It’s quick to learn and easy to get started, with the option to add more later as you go. Flask is one of the most popular options for web development, which is why employers have started to look for developers that are familiar with the framework. 

  • Django- This library is the grandfather of Python libraries and is also one of the most popular frameworks for use in web development. Django shares some similarities with Flask, but it’s more opinionated and less flexible. This can encourage more responsible coding, but the trade-off is less versatility.
  • FastAPI- This framework allows back end developers to write an API quickly while also assisting in easy documentation. FastAPI is one of the most popular Python libraries, after Flask and Django.
  • Beautiful Soup- This is a Python Package for parsing HTML and XML code. This means it’s used to sort and organize code to be translated into computer language.
  • SQL Alchemy- This library is used as an object-relational mapper for database management. Python is an object oriented language, but it’s used along with other languages that aren’t as high-level. Object-relational mappers like SQL Alchemy allow developers to easily manage problems like scalability with large databases.

Pro-Tip: What is a Python package?

A package is a Python program that has been written by another developer and open-sourced for the community to use. You could compare a package in Python to a gem in Ruby on Rails.

This pre-built code allows developers to quickly create projects without having to do the tedious and simple parts. They’re widely used and you’ll probably see the same packages across the industry. 

Uses for Python in the Real World

Python was used by web developers to build major web applications like Instagram, Spotify, and Dropbox. Here at Coding Temple, our students use Python to build their final projects – here are a few!

A user-generated book catalog called Lantern Free Library Online. Lantern Free Library Online is a Python Web app on a Flask framework with a Gunicorn server and a SQLAlchemy/Psycopg2 backend. Werkzeug encryption secures user login information. URLLib and Regex facilitate the app's interaction with the Google Books API. On the front end, Flask WTF handles the forms, and Jinja2 templates and Bootstrap 4.0 components (cards, rows, and columns) supplement the HTML5/CSS3. During development, Virtual Studio Code and PGAdmin4 were used to write the code and create the database, respectively.

BWF Shuttle API is a Flask Web Application utilizing Python libraries BeautifulSoup and Pandas to scrape badminton ranking data from BWF's Tournament Software website.

CSV and JSON files can be downloaded directly, and JSON metadata can be acquired through API calls.

ProducerFinder solves the problem of not knowing who the producer of a song is. 

You search a song's title to find that producer's name and their most popular songs. If Spotify snippets are available, they can be played. This uses JavaScript primarily...but is a very cool project! ProducerFinder was built with TypeScript, React, Redux, and Tailwind CSS, and it utilizes the Genius API and Spotify API. React and Redux were used to organize code and manage state across components.

How to Learn Python for Web Development

Learning a programming language for the first time can be scary and some languages are easier to learn than others.

At Coding Temple, we suggest using Anaconda, which is a downloadable suite that will install Python for you. It’s largely used for data science as well as machine learning and it comes with over 300 libraries. Another option is to go straight to the source. Python.org allows users to download the program and directly install it. If you do this, it’s not recommended to download directly to the PATH.

Here are some more of Joel's favorite resources for learning Python!

  • Real Python- This online resource offers tutorials, videos, and basics for people that are interested in learning Python. It’s an excellent resource for beginners and intermediate users.
  • GeeksforGeeks- This website is a popular option for different programming languages, including Python. In addition to games and tutorials for development and data structures, it offers practice and puzzles for new developers.
  • Pythontutor- It can be difficult to visualize how code works when we’re learning it. Python tutor gives you a visual breakdown of what your code is doing, line by line and variable by variable.

Finally, my advice is to fail forward and have fun with the process. Learning to program is stressful enough, so don't add more stress by trying to solve the world’s problems in a day!

Find out more and read Coding Temple reviews on Course Report. This article was produced by the Course Report team in partnership with Coding Temple.

About The Author

Liz is the cofounder of Course Report, the most complete resource for students researching coding bootcamps. Her research has been cited in The New York Times, Wall Street Journal, TechCrunch, and more. She loves breakfast tacos and spending time getting to know bootcamp alumni and founders all over the world. Check out Liz & Course Report on Twitter, Quora, and YouTube!

Not sure what you're looking for?

We'll match you!

related posts


Podcast


June 2022 Coding Bootcamp News

All the coding bootcamp news you may have missed in June!

Guide


Ask a Career Coach

Top 4 Tips for Launching a Cybersecurity Career after Bootcamp!

Instructor Spotlight


Meet a Data Science Instructor

Find out why bootcamp instructor Lindsey loves teaching data science at Flatiron School!