librelist archives

« back to archive

Changing Localhost

Changing Localhost

From:
Sayth Renshaw
Date:
2014-11-28 @ 02:59
Hi

My name is Sayth from Newcastle, Australia just starting with Flask and
hope you are all going well.

I am fairly new to flask and trying to do something simple but got it wrong
it appears.

i have to flask apps side by side the tutorial I am working off and my
version of the tutorial with things I am breaking changing etc.

so I can't run them both to localhost:5000 at same time but I want them
both open in firefox at same time to see what my changes are directly doing.

the docs say you can set host='0.0.0.0' but that makes it available.

So i adjusted the app.run of my version to

if __name__ == '__main__':
    app.run(host='http://127.0.0.1:5001', debug=True)

but this just appears to embed it in the 5000 route. how do I change this,
this is the error I get.

(myEnv)sayth@linux:~/Flask/myFlasky> python hello.py
 * Running on http://[http://127.0.0.1:5001]:5000/
Traceback (most recent call last):
  File "hello.py", line 15, in <module>
    app.run(host='http://127.0.0.1:5001', debug=True)

Thanks

Sayth

Re: [flask] Changing Localhost

From:
Paul Korzhyk
Date:
2014-11-28 @ 03:41
Hi Sayth,

You need to pass port number as a separate argument, so I'd write something
like this:
app.run(port=5001, debug=True)


See http://flask.pocoo.org/docs/0.10/api/#flask.Flask.run for details

On Fri, Nov 28, 2014 at 1:59 PM, Sayth Renshaw <flebber.crue@gmail.com>
wrote:

> Hi
>
> My name is Sayth from Newcastle, Australia just starting with Flask and
> hope you are all going well.
>
> I am fairly new to flask and trying to do something simple but got it
> wrong it appears.
>
> i have to flask apps side by side the tutorial I am working off and my
> version of the tutorial with things I am breaking changing etc.
>
> so I can't run them both to localhost:5000 at same time but I want them
> both open in firefox at same time to see what my changes are directly doing.
>
> the docs say you can set host='0.0.0.0' but that makes it available.
>
> So i adjusted the app.run of my version to
>
> if __name__ == '__main__':
>     app.run(host='http://127.0.0.1:5001', debug=True)
>
> but this just appears to embed it in the 5000 route. how do I change this,
> this is the error I get.
>
> (myEnv)sayth@linux:~/Flask/myFlasky> python hello.py
>  * Running on http://[http://127.0.0.1:5001]:5000/
> Traceback (most recent call last):
>   File "hello.py", line 15, in <module>
>     app.run(host='http://127.0.0.1:5001', debug=True)
>
> Thanks
>
> Sayth
>

Re: [flask] Changing Localhost

From:
Sayth Renshaw
Date:
2014-11-28 @ 04:30
Ah Thank you.

Much appreciated
Sayth

On Fri, 28 Nov 2014 2:45 PM Paul Korzhyk <paul.korzhyk@gmail.com> wrote:

> Hi Sayth,
>
> You need to pass port number as a separate argument, so I'd write
> something like this:
> app.run(port=5001, debug=True)
>
>
> See http://flask.pocoo.org/docs/0.10/api/#flask.Flask.run for details
>
> On Fri, Nov 28, 2014 at 1:59 PM, Sayth Renshaw <flebber.crue@gmail.com>
> wrote:
>
>> Hi
>>
>> My name is Sayth from Newcastle, Australia just starting with Flask and
>> hope you are all going well.
>>
>> I am fairly new to flask and trying to do something simple but got it
>> wrong it appears.
>>
>> i have to flask apps side by side the tutorial I am working off and my
>> version of the tutorial with things I am breaking changing etc.
>>
>> so I can't run them both to localhost:5000 at same time but I want them
>> both open in firefox at same time to see what my changes are directly doing.
>>
>> the docs say you can set host='0.0.0.0' but that makes it available.
>>
>> So i adjusted the app.run of my version to
>>
>> if __name__ == '__main__':
>>     app.run(host='http://127.0.0.1:5001', debug=True)
>>
>> but this just appears to embed it in the 5000 route. how do I change
>> this, this is the error I get.
>>
>> (myEnv)sayth@linux:~/Flask/myFlasky> python hello.py
>>  * Running on http://[http://127.0.0.1:5001]:5000/
>> Traceback (most recent call last):
>>   File "hello.py", line 15, in <module>
>>     app.run(host='http://127.0.0.1:5001', debug=True)
>>
>> Thanks
>>
>> Sayth
>>
>
>