Senior full stack developer and CTO at Ideamotive.
Python belongs to one of the most popular programming languages for web development. According to BuiltWith, there were a total of 160,211 live websites in July of 2021. Such popularity of the language is guaranteed by Python’s good utility. 7581 websites successfully proceed with traffic of more than 1 million visits per month. The functionality of Python-based websites is supported by a number of clever libraries and frameworks that shine in the hands of talented developers.
The requests library is a simple, yet elegant tool to handle HTTP requests. It allows completing all of the required steps of the Request-Response Cycle such as sending, receiving, matching, running, delivering, and viewing.
Flask WSGI micro-framework is a simple tool to develop a web application. To keep the core of the application clean and scalable, the database abstraction layer is not included in the framework by default. Instead, extensions to gain new capabilities are supported. Such extensions provide open authentication technologies, upload handling, form validation, and more. The framework is compatible with Google App Engine which comforts Python web app hosting.
Django framework is a scheme with model-view-controller (MVC) architecture designed for fast development and rapid updates. MVC architecture allows to separate concerns between the UI and the business logic. Django’s fundamental conventions are pluggability, reusability, the inclusion of low coupling, and the “don’t repeat yourself” principle.
django CMS is a convenient tool to administer a website’s content. It was born from the frustrating experience of using such CMS’es as WordPress and Drupal and is a good alternative to them. The editing mode is quite intuitive and the variety of plugins is supported. New applications and widgets are easy to implement. Integration with such frontend frameworks as Bootstrap makes it easy to optimize the website both for the PC and mobile devices.
Now, when we are familiar with Python’s libraries and frameworks, let’s have a look at real-life examples of Python website development.
Since 2011, one of the biggest image-sharing services Pinterest is using Python’s framework Flask to support API. Since Flask is horizontally scalable, the development team managed to handle more than 12 billion requests per day and the number may be increased! The challenge of developing with Flask was low-level decorators. Steve Cohen, the API developer at Pinterest, mentions that it was complicated to set up decorators right so the team had to consolidate several of them into a single one.
An interesting case of applying Flask was conducted by the team of Linkedin. The request from the lead engineer was to develop a tool that will hide some parts of the app’s code from the end-users. After a discussion with the development team, the technical lead Rachel Sanders decided to use a Flask framework to deploy a new feature. After several weeks of work, a Flask Feature Flag extension was delivered.
The other example of a social network using Python for website development is Reddit. Originally written in Common Lisp, Reddit was redesigned with Python’s framework web.py in December 2005. The language has been used ever since. As was said by Reddit’s co-designer Aaron Swartz, an alluring feature of web.py was the independence of functions. The developer could put the files wherever was needed, and web.py would gladly follow along. If it was required for a piece of code to be run as a Python web app, the developer could call web.run.
The Washington Times
The release of the Django framework in 2003 by the team of Lawrence Journal-World opened the way for further implementation of the Python website development by news agencies. One of the most-visited websites is The Washington Times page. The content of the website is dynamically updated. Implementation of such Python libraries as Seaborn and ggplot allowed the designers to create powerful data visualizations. An example of such influential visualizations is the plots for the article Why outbreaks like coronavirus spread exponentially, and how to “flatten the curve”. The article itself gathered more than 122,000 retweets and became one the most read journalistic text of 2020.
If you are interested in the development of the mobile application with Python as well, check our guide our guide on when and why to build apps with this language.
The other great example of a Python project build with Django is the website of National Geographic. The framework provides all the necessary tools for the development of GIS applications and maps are the main content of the geographic society. To get assured of Django’s capabilities, check National Geographic’s online map-making tool. An interactive tool allows users to add layers, edit legend, draw, markers, lines, and polygons, measure distances. The final result may be saved in the cloud or printed.
Check our blog post to find more amazing examples of applications developed with Django.
Python is really beloved by Google. According to the Burning Glass analytics for 2020, the knowledge of Python is the most demanded skill by the tech giant. The language was mentioned in 33% of hiring advertisements. Alex Martelli, Senior Staff Engineer at Google, says that the great prominence of Python website development was the motivation for many talented programmers to join the company. That is true for Greg Stein, Wesley Chun, Fredrik Lundh, Thomas Wouters, and many others. Even the creator of Python, Guido van Rossum, spent seven years developing the language and implementing it in the company’s projects. The most significant is the web-based code review tool named Mondrian.
For Google, Python became an essential technology in the development of the search engine. The entire web crawler is written in Python. With each search request, the app scans hundreds of millions of web pages and puts them in order in the search index. The sitemap files are analyzed as well.
Since Google’s search engine is built with Python, it is logical to perform search engine optimization (SEO) with Python as well. Luckily, the community has developed a number of convenient tools for such a task. The sitemap XML file may be edited with Django’s Sitemap framework. The URLs may be optimized with Django’s SlugField which contains only letters, numbers, underscores, or hyphens. A test crawl of the website and analyses of the URL status code may be performed with the script which is called Pylinkvalidator. The information about word count, page title, meta description, keywords on-page, missing titles, and missing description may be obtained with the script named SEO analyzer.
Python’s great scalability and good performance make it a good language for the development of a streaming platform. As an example, the language is widely used by Spotify. Company's back end team lead Geoff van der Meer says:
Spotify's backend consists of many interdependent services, connected by own messaging protocol over ZeroMQ. Around 80% of these services are written in Python.
In addition to the streaming services, the other competitive feature of Spotify is an accurate recommendation algorithm, and Python here is of great use. Among different libraries, the development teams chose Luigi as the most convenient tool to quickly build complex pipelines of batch jobs. The analysis of users’ preferences is performed with a number of Python’s machine learning libraries such as Scikit-learn.
The other streaming service strongly dependent on Python is Netflix. The language is used through the full content lifecycle from budget planning to operating the content delivery network (CDN). In Netflix, the content is placed on the network of servers in the Open Connect CDN as close to the viewer as possible. Different software systems are required to design, build, and operate such an infrastructure. A separate application is needed to track the inventory of network gear. They collect and proceed with data about device models, hardware components, and the location of the devices. Device interaction for the collection of health and other operational data is yet another app. All of the mentioned tasks are managed by the Python applications.
To stream the video content to a viewer the file should be encoded and re-encoded. In Netflix, both operations are handled by Python packages. The company's development team is a regular contributor to the Mezzanine File System and vmaf.
In 2021, e-commerce is a predominant sales channel, and the global pandemic enforced the growth of online shopping. The data shows that during the first three months of the global lockdown e-commerce has grown as much as it did during the previous 10 years. As the retailers were forced to close their shops, consumers were forced to turn to online shopping. During the pandemic, a total of 84% of consumers shopped online; therefore, online purchases reached 16.4% of total global retail sales. If you are planning to build a profitable retail business, a webshop is a must.
The world’s leading company in providing e-commerce services is Shopify. The platform provides customers with tools and solutions for payments, marketing, shipping, and other needs. Although the company itself sticks with Ruby as a primary programming language, Python is often used for the development of additional applications. Samples of such applications may be found at Github. Read our blog post to find more exciting examples of Shopify websites.
If you are interested in other web development technologies and want to compare them with Python, check our blog posts about Angular and React.
To build a devoted community around the brand, the company should allow clients to express their feelings. The feature of commenting for the websites may be obtained from the app called Disqus. Real-time discussion interactions such as recommendations, upvotes, downvotes, threaded replies, and others are supported as well. Disqus Analytics allows customers to understand better audience interests. The tool provides data about articles reads, comment reads, and total engagement.
The technology powering the app is Django. The Head Coach of Disqus Matt Robenolt explains that the decision in favor of Django was made because the company prefers rapid development and familiarity over performance. Although the framework performs rather slowly, the team managed to build a system that generates 8 billion page views per month and 45k requests per second.
The proof of Python’s capability to manage more than 1 billion active users per month is its implementation in the Instagram social network. According to Instagram’s Director of Engineering Hui Ding, the language was chosen in the first place because of the company's motto “Do the simple things first”. Python indeed is simple and clean. The language is user-friendly for engineers so that the development usually goes fast. It allows the team to concentrate on developing and testing new features. Such a characteristic is a crucial competitive trait of modern technological business. Quoting Hui Ding:
Performance speed is no longer the primary worry. Time to market speed is.
The other valuable property of the language is its popularity among the IT community. Since Python belongs to one of the most desired coding systems, it is easier to expand the engineering team when the startup starts growing.
In 2017, Instagram moved from Python 2.7 to Python 3 for performance reasons. The whole modernization of the legacy software system took roughly 10 months. The results were astonishing: a newer version of Python used 12% less CPU and 30% less memory.
An example of a sophisticated yet elegant Python web app is Prezi. An app is a tool for designing beautiful dynamic presentations with powerful built-in analytics to measure the results. With an audience of more than 100 million users, worldwide Prezi is a confident competitor of such giants as Microsoft PowerPoint and Google Slides. Presentations made with Prezi can be seen at Clinton Foundation, Lufthansa, IBM, and TED conferences. Such commercial success was achieved thanks to Django CMS. Jonathan Schwartz, Senior Product Manager at Prezi affirms:
Django CMS with Divio Enterprise Services allows the Prezi team to focus more on what's important: creating the best possible content and services for our users.
Indeed, with the implementation of Django CMS, the company managed to deliver such product features as dynamic designs, full responsiveness, visual representation, and a vast catalog of interactive presentation templates.
Contact us if you are inspired by Prezi’s success and want to use Django for your product.
As a programming language Python appeared to be a great tool for the development of an MMORPG called EVE Online. At the core of the game is Stackless Python or Stackless interpreter. The most important feature of Stackless is the support of microthreads. The other prominent characteristics include coroutines, communication channels, and task serialization. The game code written with Python is responsible for user interface and management of graphic resources while low-level tasks like 3D rendering, network communication, or input handling are performed with C++. A successful mixing of Python and C++ allowed the development team to create an extremely concurrent application. In 2018, the game set the Guinness World Record of the biggest online PvP battle. 6,142 players simultaneously took part in an enormous conflict.
The second-largest ride-sharing company in the USA named Lyft powers its applications with Python. The company provides its services in more than 300 cities in the United States and shares 30% of the American market. Lyft’s app receives orders, navigates the drivers, and proceeds the payment. One of the new features released during the autumn of 2020 was the option to compare bike/scooter modes against rideshare and transit modes. The feature was built with the help of gevent - a coroutine-based cooperative multitasking Python framework. The cooperation of the code relies on monkey patching. The framework draws its lineage from EVE Online. Applied by the MMORPG Stackless Python eventually evolved into an eventlet that inspired gevent.
If you ever shortened the URL you probably have visited another example of the Python website - Bitly. The mentioned platform is another example of Python’s implementation. The language is used mainly for link management. Currently, Bitly administrates over 600 million links annually. There is also an API available that allows integrating platform services with a Python application.
As you have seen, Python is indeed a universal programming language. It effectively powers search engines, maintains streaming platforms, manages social networks, and supports e-commerce platforms. With Python, it is possible to create astonishing interactive websites. The short development time of Python applications makes it a perfect decision for the MVP projects and products with the rapid deployment of new features.
Eager to develop your next project with Python? There are many Python devs in our network. Contact us! We will gladly connect with the best talents acquainted with your industry and company culture.
Dawid is a full stack developer experienced in creating Ruby on Rails and React Native apps from naught to implementation. Technological superhero, delivering amazing solutions for our clients and helping them grow.