Question

EDIT:

I looked at the chrome error code and it said: Error code: ERR_UNSAFE_PORT. I changed the port to 6001 and it works fine - why would that be, is 6000 generally a port you can't use for local development for some reason?

I've built the hello world app (I've called it app.py) like so:

from bottle import route, run

@route('/hello')
def hello():
    return "<h1>Hello World!</h1>"

run(host='localhost', port=6000, debug=True)

And I'm in a virtualenv setup with app.py in the same directory level as bin/, include/, and lib/ folders from the virtual environment. The file bottle.py is inside bin/ When I run python app.py, I get this output:

Bottle v0.12.3 server starting up (using WSGIRefServer())...
Listening on http://localhost:6000/
Hit Ctrl-C to quit.

But when I go to http://localhost:6000/hello I get "This website is not available" in Chrome. Have I structured my files wrong somehow? Thanks!

Was it helpful?

Solution

It's not your app, it's Chrome.

From https://superuser.com/a/188012/220530:

Right Click on Chrome shortcut >> Properties >>

Then Append --explicitly-allowed-ports=xxx to shortcut target

Example:

C:\Documents and Settings\User\Local Settings\Application Data\Google\Chrome\Application\chrome.exe --explicitly-allowed-ports=6666

OTHER TIPS

For windows 8.1,

Right Click on Chrome shortcut >> Properties >>

Then Append --explicitly-allowed-ports=xxx to shortcut target

Example:

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --explicitly-allowed-ports=6666

I looked at the chrome error code and it said: Error code: ERR_UNSAFE_PORT. I changed the port to 6001 and it works fine - why would that be, is 6000 generally a port you can't use for local development for some reason?

THere is a list of unsafe port for chrome:

https://superuser.com/a/188070/565230

The reason it's called unsafe is not because it's unsafe to Chrome, it's because it's unsafe to those services, where an attacker may try to use Chrome as a proxy to attacking services on those ports.

https://superuser.com/a/465228/565230

Among the ports listed, 6000 is the port used by X11.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top