Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Learning Python Networking
  • Table Of Contents Toc
Learning Python Networking

Learning Python Networking

By : Sam Washington
3.7 (7)
close
close
Learning Python Networking

Learning Python Networking

3.7 (7)
By: Sam Washington

Overview of this book

If you're a Python developer or a system administrator with Python experience and you're looking to take your first steps in network programming, then this book is for you. Basic knowledge of Python is assumed.
Table of Contents (12 chapters)
close
close
10
A. Working with Wireshark
11
Index

Hosting in practice

So how does this all work in practice? Well as we saw with Flask, many frameworks come with their own built-in development web servers. However, these are not recommended for use in a production environment as they're generally not designed to be used where security and scalability are important.

Currently, probably the quickest way to host a Python web application with a production quality server is with the Gunicorn server. Using our Flask application from earlier, we can get it up and running using just a few steps. First we install Gunicorn:

$ pip install gunicorn

Next we need to slightly modify our Flask app so that it's use of __builtins__ works correctly under Gunicorn. In your tinyflaskapp.py file, find the line:

objs = __builtins__.__dict__.items()

Change it to:

objs = __builtins__.items()

Now we can run Gunicorn. From within your Flask application project folder, run the following command:

$ gunicorn --bind 0.0.0.0:5000 tinyflaskapp:app

This will launch...

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Learning Python Networking
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon