Posts Tagged ‘localhost’

[flask] show external images with an app. running on localhost

November 3, 2019 Leave a comment

I have a Flask app. that I run on my local machine. I wrote it years ago and it worked well at that time. Now, I tried to run it again but the external images didn’t appear, they were broken. These are images that are located somewhere else, I just link them. When I copied their URL and pasted in the location bar of the browser, they appeared. What da?

It seems Firefox is blocking localhost, so when I visited, some of its elements got blocked.

As a workaround, I added the following line in my /etc/hosts file:   jabba-hq

Then, when I visted http://jabba-hq:5000, the images appeared normally.

Categories: flask, python Tags: ,

Python web server on localhost

November 10, 2011 Leave a comment
python2 -m SimpleHTTPServer

Tip from here.

Python 3

python3 -m http.server

Update (20170914)
If you want to share a file with several people, use Node.js. The Python web server (as seen above) is single threaded, while Node.js works in async mode. Read more here.

Categories: python Tags: , ,