Python on the Web: The Amazing Things You Can Build
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 .
How Python Is Used in Web Development
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.
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.
Python vs. Other Web Development Languages
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:
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 .
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.
Start Using Python for Web Development
Ready to get started but have no Python experience? No worries. Check out our basic examples of Python to see how Python feels and to get a grip on the fundamentals. After that, check out these YouTube programming channels — 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 . 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!
Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.