librelist archives

« back to archive

Flask App Config SERVER_NAME

Flask App Config SERVER_NAME

From:
McCully, Sean
Date:
2014-02-13 @ 15:56
After creating a Flask app, I’ve noticed that unless you specify host in 
the arguments to Flask.run it will always run on 127.0.0.1. Ignoring the 
host specified in Flask.config[‘SERVER_NAME’]. Is this the intent?

https://github.com/mitsuhiko/flask/blob/master/flask/app.py#L760

What is the a actual purpose of Flask.config[‘SERVER_NAME’]? SERVER_NAME, 
appears to be a bit of a misnomer if it only allows setting of port.



Sean

Re: [flask] Flask App Config SERVER_NAME

From:
gioi
Date:
2014-02-13 @ 16:36
Subdomain matching. That's it.
And it's also useful if you can't trust the Host header.
BTW, you probably want to bind your app to IP addresses, and not to
hostnames :)

And remember, you shouldn't use app.run in production. You probably
already know it, but it's very important.

Re: [flask] Flask App Config SERVER_NAME

From:
McCully, Sean
Date:
2014-02-13 @ 17:05
Ah, I see. Thanks for pointing that out. 	

On 2/13/14, 10:36 AM, "gioi" <g@gioi.tk> wrote:

>Subdomain matching. That's it.
>And it's also useful if you can't trust the Host header.
>BTW, you probably want to bind your app to IP addresses, and not to
>hostnames :)
>
>And remember, you shouldn't use app.run in production. You probably
>already know it, but it's very important.
>
>