Python is a powerful language that supports many of the largest sites on the web. There are several prominent Python web development frameworks, each with their own use cases and features.

In fact, you probably visit a website powered by Python every day. Heard of Reddit? Instagram? Yelp? They all use Python.

It can be a little overwhelming to hear all the jargon being thrown around (Django? Flask? Pyramid?), so we’re going to break things down step-by-step here. Who’s using Python for web development, why, and what are the options out there as a developer?

Django

Django is the most robust and full-featured of the pack. It has also been around the longest. Their motto is “The web framework for perfectionists with deadlines.” Because of this, the framework is very pragmatic and structured, but it can be quite opinionated at times. If you’re doing something that fits into their “way” of doing things, great. But if you have a more off-the-wall project, it may be more difficult to work around Django’s design constraints.

While it interfaces with databases quite well, it can be a lot of overhead if you’re just wanting to make a small project.

Here is a selection of popular sites that use Django:

Flask

If you’re starting out and Django is a little too complicated, look no further than Flask. It bills itself as a “microframework” and can set up a running web server in less than 10 lines of code. It’s lightweight, fast, and very customizable.

However, extra libraries or configuration may be needed for more complex sites on Flask. That’s the downside of having creative freedom within the framework. It doesn’t enforce standards like Django, which can be both a pro and a con depending on your use case.

If you’re just looking for a small web server or a personal web site, Flask is a good option.

Sites that use Flask include:

Pyramid

Pyramid seeks to bridge the gap between “megaframeworks” like Django and “microframeworks” like Flask. Their motto is “smart small, finish big, stay finished.” This means that you can get a web service up and running easily (similar to Flask), but Pyramid provides more resources and libraries to support scaling your site as well.

Companies using Pyramid include:

Static Site Generators

Static site generators are the new kids on the web development block. Instead of describing your website in a programming language you may or may not fully understand, static site generators allow you to write posts in (more or less) plain text. Many static site generators let you write in Markdown, which is basically just plain text with a little extra seasoning for formatting text and links. They then use a rendering engine to make your text appear on the web page in a structured and styled form. These sites are even more lightweight than Flask, which means there’s very little if any overhead to learn and set up.

The word “static” here means that you cannot interface with a database within this website. That means stuff like databases, registering new users, and dynamic code execution are not possible within this model. Some people see this as a perk rather than a limitation; many of the most nefarious web security vulnerabilities come from leaving the database exposed. If there’s no database to begin with, many of those vulnerabilities do not exist for your site.

If you’re looking for something that you can update easily and doesn’t have all the security worries of something like WordPress, give a static site generator a try.

Some of the most popular static site generators for Python include:

Pros and Cons of Python for Web Development

Because Python is a pretty simple and intuitive language to pick up, it’s accessible to coders and non-coders alike. The thriving Python development community ensures there’s a wealth of packages available to help you program just about anything you can imagine. Put a couple libraries together with one of the frameworks mentioned above, and the possibilities are limitless.

That being said, it’s not perfect. Here are some situations where you might not want to use Python:

  • Mobile development
  • Memory-intensive calculations
  • Performance-critical applications

Despite the shortcomings, Python is a strong choice for web developers old and new.

The following two tabs change content below.
mm

Al Nelson

Al is a geek about all things tech. He's a professional technical writer and software developer who loves writing for tech businesses and cultivating happy users. You can find him on the web at http://www.alnelsonwrites.com or on Twitter as @musegarden.

Comments

comments