Pinterest Stumbleupon Whatsapp
Advertisement

In many ways, we’re living in the golden age of web development. Web technologies have never been as refined and flexible as they are today, and if you want to build a high-quality website or web app, you have so many viable ways to get there — including the use of Python 5 Reasons Why Python Programming Is Not Useless 5 Reasons Why Python Programming Is Not Useless Python -- You either love it or you hate it. You might even swing from one end to the other like a pendulum. Regardless, Python is a language that's hard to be ambivalent about. Read More .

Contrary to popular belief, Python isn’t only useful for data processing and utility scripts. Take a peek at HotFrameworks.com and you’ll see that the fifth most popular web framework is Python-based. Next to JavaScript and Ruby, Python is one of the best languages to use for web development.

How Python Is Used in Web Development

When developing a web app, Python serves in similar capacity to languages like PHP and Ruby: it’s mainly used to handle back-end processing and routing. Web pages still need to be rendered using HTML, the theme is still handled with CSS, and front-end processing is still done in JavaScript.

That may sound overwhelming, but depending on which Python web framework you use, it doesn’t have to be as bad as it sounds. For example, Django has a templating system for writing special HTML files that can embed Python code and interact with data from the Python back-end.

Template example from the official Django tutorial

This kind of framework is called a full-stack framework — one that comes with systems that handle HTTP requests, database storage, web page templates, routing requests, etc. On the other side, you have a non-full-stack framework, also called a micro-framework, that only handle the basic back-end logic and needs to be combined with third-party databases, templating engines, etc.

In general, full-stack frameworks have steeper learning curves and force you to adopt certain conventions and structures, but provide everything you need. Micro-frameworks can be learned in no time and are more flexible, but you may need to re-invent wheels with every new project.

Advertisement

Python vs. Other Web Development Languages

As of this writing, JavaScript frameworks like React 7 Best Free Tutorials for Learning React and Making Web Apps 7 Best Free Tutorials for Learning React and Making Web Apps Free courses are rarely as comprehensive and helpful -- but we've found several React courses that are excellent and will get you started on the right foot. Read More are soaring in popularity, particularly among newbie web developers. The line of thought goes: “If I need JavaScript for the front-end, why not use JavaScript for the back-end too?” That makes sense. And PHP has been around for decades with lots of documentation, so it’s also a viable option.

At the end of the day, use whatever language you want to use. Anything you can make with one language can be made with another — all that really matters is how comfortable you are using it. If a language isn’t a good fit for you, you’ll just be frustrated and quit. But here’s why I love Python:

  • Python is clean and easy to learn. Both JavaScript and PHP are “programmery” (e.g. lots of braces, weird syntax, etc.) and come with all kinds of baggage that can lead to messy and unmaintainable code. Python is one of the easiest languages to learn 6 Easiest Programming Languages to Learn for Beginners 6 Easiest Programming Languages to Learn for Beginners Learning to program is about finding the right language just as much as it's about the edification process. Here are the top six easiest programming languages for beginners. Read More and doesn’t feel like a programming language. It’s also compact — you can write a lot of logic in a few lines of code.
  • Python web frameworks are less fragmented. JavaScript has dozens of oft-used frameworks: Backbone, React, Vue, Angular, Knockout, Ember, Meteor, etc. Python also has a lot of frameworks but only a few of them are used seriously (see below for examples), so the community isn’t as fragmented. PHP has a leg up on Python though, as there’s only one viable framework these days: Laravel.
  • Python is a general purpose language. JavaScript is mostly limited to two pursuits: web development and mobile app development. PHP is even more restricted, only able to be used for back-end web development. Python is vastly more flexible, which means you can take your expertise with you if you ever move on from web development Programming vs. Web Development: What's the Difference? Programming vs. Web Development: What's the Difference? You might think application programmers and web developers do the same job, but that's far from the truth. Here are the key differences between programmers and web developers. Read More .

Popular Python Web Frameworks

To get started in Python web development, you should seriously consider using one of the following. They’re all robust with a significant amount of history, so you can rest assured knowing that they are good enough for production use and won’t disappear overnight.

Django — The premier all-in-one web framework for Python enthusiasts. It comes with dozens of built-in components that are all well-tested and guaranteed to work together. You’ll have to learn “the Django way” to make web apps, but once you embrace that, rapid development is the norm. And if you want a job as a Python web developer, Django is pretty much the only path.

One thing to note about Django: it’s very good at scaling. As your web app grows larger and larger, it will generally be easier to stay organized than if you had used another Python web framework. And Django is open source, in case you’re interested in contributing The 10 Best Open Source Projects You Should Be Volunteering To Help With The 10 Best Open Source Projects You Should Be Volunteering To Help With You don't have to be a programmer. You could be a writer, a designer, a translator, just a Facebook or Twitter junkie, or someone who wants to just donate money for the cause. There are... Read More .

Flask — A micro-framework that only provides enough to get started and gives you full control as to which third-party components you’ll integrate. In this sense, it’s almost the polar opposite of Django: Flask offers nearly zero opinion in how you should build a web app. It’s simple and easy to learn.

This is a double-edged sword. If you know you need to use such-and-such technologies, then Flask can be the minimal glue that holds them all together. If you have no experience, however, you can easily shoot yourself in the foot over and over again in trying to tame Flask.

Pyramid — You can sort of think of Pyramid as a compromise between Django and Flask. It’s nowhere near as opinionated as Django and you’ll have more freedom to organize your web app as you wish, but it is somewhat opinionated and isn’t as barebones as Flask.

Another way to think of it: Pyramid comes with a lot of default functionality, but makes it easy to override them as necessary. Pyramid has a large library of official and unofficial plugins that you can pick and choose on a per-project basis.

Examples of Sites Using Python

If you’ve gotten this far and you’re still skeptical of Python being used for web development, here are a handful of well-known sites that were created using the above frameworks. What you’ll find is that Python is an excellent choice for websites and web apps, whether small, large, minimal, or complex.

Instagram (made with Django)
Bitbucket (made with Django)
Reddit Gifts (made with Django)
Talk Python (made with Pyramid)
AdRoll (made with Pyramid)
The Daily Climate (made with Pyramid)

Start Using Python for Web Development

Ready to get started but have no Python experience? No worries. Check out our basic examples of Python 10 Basic Python Examples That Will Help You Learn Fast 10 Basic Python Examples That Will Help You Learn Fast This article of basic python examples is for those who already have some programming experience and simply want to transition to Python as quickly as possible. Read More to see how Python feels and to get a grip on the fundamentals. After that, check out these YouTube programming channels The 17 Best YouTube Programming Tutorials The 17 Best YouTube Programming Tutorials In this post, we'd like to point you to some of the best YouTube programming series we've found. All of these are sufficient for getting your feet wet as a newbie programmer. Read More — in particular, the ones related to Python and web development (look for the ones on Django and Flask).

On top of that, I highly recommend listening to some programming podcasts 15 Top-Notch Podcasts for Programmers & Software Developers 15 Top-Notch Podcasts for Programmers & Software Developers Podcasts are a fantastic way to learn more about programming. Here are some of our favorite programming-related podcasts for your listening pleasure. Read More . There are several that will go hand-in-hand with your journey through Python and web development. I’m especially fond of Developer Tea, a short daily podcast that’s motivating and relaxing.

How do you feel about Python? Will you be using it for web development? What kinds of sites or apps do you want to make? Share with us in the comments below!

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. Daniela
    April 5, 2017 at 1:52 pm

    I tried django and tornado, and I like more tornado not sure why , maybe is for the async stuff. maybe you need speak about it