Python - Deploying Bottle Web Apps (NGINX, Gunicorn, Python)

preview_player
Показать описание


This course, **Bottle, Gunicorn, and NGINX for Production**, introduces deploying a Python web application in a production-ready environment using Bottle, Gunicorn, and NGINX. Starting with a simple Bottle application, participants will understand how to move from development to a robust production setup that handles multiple users, implements reverse proxying, and optimizes performance.

The course begins with setting up a basic Python web app using Bottle, a minimalist web framework. This will introduce the structure and functionality of Bottle applications, demonstrating how to define routes and return simple responses. Students will build a simple app with a random integer feature to visually confirm application updates upon refresh. After covering the basics of Bottle, the course transitions to setting up Gunicorn, a Python Web Server Gateway Interface (WSGI) server designed to handle multiple concurrent users and optimize application performance. Using Gunicorn, students will learn to deploy the Bottle app with multiple workers and bind it to a designated port, ensuring scalable performance for incoming requests.

Key steps involve configuring Gunicorn to interact seamlessly with the Bottle app, including assigning a name to the application instance (`myapp = default_app()`). This approach allows Gunicorn to reference the app instance directly, bypassing the need for the `run()` method when deploying in production. With a solid understanding of running the application on Gunicorn, students will advance to setting up a complete tech stack, including DNS configuration, operating system-level settings, and installation of NGINX as a reverse proxy server.

NGINX will serve as the intermediary between the web and application servers, efficiently handling requests and routing them to the Gunicorn server running the Bottle app. Students will gain hands-on experience configuring NGINX by editing site files and setting up proxy headers. This configuration enhances security and stability while managing requests and responses, freeing up Gunicorn to focus solely on app handling.

A practical aspect of the course involves setting up a user account for the app, securing folder permissions, and isolating application processes for increased security. Attendees will create a virtual environment for the app and install necessary dependencies, ensuring an isolated environment free from conflicting packages or system-wide changes. Participants will also configure the app as a service on Linux systems, using `systemd` for process management. This will cover defining environment variables, setting execution parameters, and automating the app's startup on reboot.

Further security can be added by configuring NGINX to communicate with Gunicorn through a UNIX socket instead of a local IP address. The course details the permission and ownership adjustments required to enable this setup, offering an added layer of security for sensitive applications.

Finally, students will test configurations to ensure everything runs smoothly and address common issues like permission errors, NGINX syntax validation, and service restarts. By the end of this course, students will have a complete end-to-end understanding of deploying Python web applications in a professional setting using Bottle, Gunicorn, and NGINX, ready to scale and handle production traffic securely and efficiently.
Рекомендации по теме
Комментарии
Автор

I have been watching you since i am 18 now i am 29, and i still like your style of teaching... Thank you for being a foundational contributor in my journey to be a Data Engineer

kanemtrade
Автор

Eli I started watching you at 13 years old. I’m now almost 30 still watching.

whatareyousaying
Автор

Great to see you still going strong. Thanks for posting thanks for being around.

gezenews
Автор

4:26 ..in 4k, ...still kind of small. Remember when videos would be done in 720 images just for those who couldn't fit the 1080 in their screens ?, I think you could record in 4k for a 1080 audience. Also, is good to see you back after the flood 💛

LuisYomba
Автор

Having not configured a Linux service from scratch it was interesting to know more about how that is done. I've also not seen the .sock file method of getting apps to communicate directly without the use of TCP/IP. Good lesson 👍

Kifter
Автор

Damn! I used to watch you religiously like 12 years back! Then I remember you got pissed off at YT and I thought you left! What a pleasant surprise to Elli the computer guy. I have some catch up to do.

pepperzen
Автор

Is that class was online I didn't see the announcement of it ??

mohcinelayati
Автор

Did you lose your orange hoodie in the flood?

Nom_AnorVSJedi
Автор

Bottlepy? Man that’s something I haven’t seen in a decade. I know there’s still people starting new project with flask even tho fastapi would be a better solution for many. But bottle? Wow

hanes