While building my own Flask application for learning purposes. I was not sure how it was being served on the web. I did not install Apache of any other web server, but it is running on my Digital Ocean test server. The I found out about Python’s built-in HTTP server.

This final purpose of this app is to keep track of your blood pressure at home. I will keep you posted about the progress. You can also see my Github repo and offer any suggestions if you like.

Anyways, after having a great cup of Latin America coffee I discovered that Python has an standard HTTP server built into the standard library. So, when I run my CMD python run.py at the end of my Dockerfile it starts the Python standard HTTP build-in server for me.

If you like to run it alone for other testing purposes you can do the below.

For Python 3.x:

python3 -m http.server

For Python 2.x

python -m SimpleHTTPServer 8000

This will serve the current directory at your http://localhost:8000 or http://127.0.0.1:8000

Python’s built-in HTTP server is a useful standard library that I was not aware or did not occur to think about it until today. Don’t know why.

I invite you to check my other posts about setting up Ubuntu server static IP. Thanks and let me know if you have any questions.

Leave a comment

Your email address will not be published.