Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #107005 > unrolled thread

how to setup for localhost:8000

Started bywrh8609@gmail.com
First post2016-04-14 10:46 -0700
Last post2016-04-15 17:38 +1000
Articles 14 — 9 participants

Back to article view | Back to comp.lang.python


Contents

  how to setup for localhost:8000 wrh8609@gmail.com - 2016-04-14 10:46 -0700
    Re: how to setup for localhost:8000 Peter Otten <__peter__@web.de> - 2016-04-14 20:07 +0200
    Re: how to setup for localhost:8000 Andrew Farrell <armorsmith42@gmail.com> - 2016-04-14 13:06 -0500
      Re: how to setup for localhost:8000 wrh8609@gmail.com - 2016-04-14 13:50 -0700
        RE: how to setup for localhost:8000 Dan Strohl <D.Strohl@F5.com> - 2016-04-14 21:14 +0000
        Re: how to setup for localhost:8000 Pierre Quentel <pierre.quentel@gmail.com> - 2016-04-15 12:03 -0700
          Re: how to setup for localhost:8000 wrh8609@gmail.com - 2016-04-16 15:35 -0700
            Re: how to setup for localhost:8000 Monte Milanuk <memilanuk@gmail.com> - 2016-04-17 09:27 -0700
            Re: how to setup for localhost:8000 Pierre Quentel <pierre.quentel@gmail.com> - 2016-04-17 10:11 -0700
              Re: how to setup for localhost:8000 wrh8609@gmail.com - 2016-04-22 14:41 -0700
    Re: how to setup for localhost:8000 Random832 <random832@fastmail.com> - 2016-04-14 14:36 -0400
    Re: how to setup for localhost:8000 Chris Angelico <rosuav@gmail.com> - 2016-04-15 04:39 +1000
    Re: how to setup for localhost:8000 Vito De Tullio <vito.detullio@gmail.com> - 2016-04-15 07:59 +0200
    Re: how to setup for localhost:8000 Chris Angelico <rosuav@gmail.com> - 2016-04-15 17:38 +1000

#107005 — how to setup for localhost:8000

Fromwrh8609@gmail.com
Date2016-04-14 10:46 -0700
Subjecthow to setup for localhost:8000
Message-ID<5ea1e31b-09ba-4b6a-be8b-58886c5c5f81@googlegroups.com>
Hi,

I am working on window 7 and Python 3.5 to setup a localhost:8000 but it did not get through as shown below:
> python -m http.server
Serving HTTP on 0.0.0.0 port 8000 ...

But it did not show the results.

Can someone help me how to setup the localhost?

Thanks,
Wen-Ruey

[toc] | [next] | [standalone]


#107006

FromPeter Otten <__peter__@web.de>
Date2016-04-14 20:07 +0200
Message-ID<mailman.111.1460657285.15650.python-list@python.org>
In reply to#107005
wrh8609@gmail.com wrote:

> I am working on window 7 and Python 3.5 to setup a localhost:8000 but it
> did not get through as shown below:
>> python -m http.server
> Serving HTTP on 0.0.0.0 port 8000 ...

That looks correct so far. Now open a browser and open

http://localhost:8000/

[toc] | [prev] | [next] | [standalone]


#107007

FromAndrew Farrell <armorsmith42@gmail.com>
Date2016-04-14 13:06 -0500
Message-ID<mailman.112.1460658199.15650.python-list@python.org>
In reply to#107005
What happens when you type

http://localhost:8000

Into the address bar of your browser as this is running?

On Thu, Apr 14, 2016 at 12:46 PM, <wrh8609@gmail.com> wrote:

> Hi,
>
> I am working on window 7 and Python 3.5 to setup a localhost:8000 but it
> did not get through as shown below:
> > python -m http.server
> Serving HTTP on 0.0.0.0 port 8000 ...
>
> But it did not show the results.
>
> Can someone help me how to setup the localhost?
>
> Thanks,
> Wen-Ruey
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>

[toc] | [prev] | [next] | [standalone]


#107013

Fromwrh8609@gmail.com
Date2016-04-14 13:50 -0700
Message-ID<2e597a56-00ab-4370-b337-667f34eac56a@googlegroups.com>
In reply to#107007
On Thursday, April 14, 2016 at 2:23:36 PM UTC-4, Andrew Farrell wrote:
> What happens when you type
> 
> http://localhost:8000
> 
> Into the address bar of your browser as this is running?
> 
> On Thu, Apr 14, 2016 at 12:46 PM, <wrh8609@gmail.com> wrote:
> 
> > Hi,
> >
> > I am working on window 7 and Python 3.5 to setup a localhost:8000 but it
> > did not get through as shown below:
> > > python -m http.server
> > Serving HTTP on 0.0.0.0 port 8000 ...
> >
> > But it did not show the results.
> >
> > Can someone help me how to setup the localhost?
> >
> > Thanks,
> > Wen-Ruey
> >
> > --
> > https://mail.python.org/mailman/listinfo/python-list
> >

hi Andrew,

Yes. after I type http:\\localhost:8000, the browser did not show anything except a empty page without any errors.

Thanks,
Wen-Ruey

[toc] | [prev] | [next] | [standalone]


#107016

FromDan Strohl <D.Strohl@F5.com>
Date2016-04-14 21:14 +0000
Message-ID<mailman.119.1460668518.15650.python-list@python.org>
In reply to#107013
If you got an empty page with no errors (and no warnings trying to get there...) it is likely that your server is working, and you are trying to access it correctly, but the server is not serving anything.  Most of the time, if the server is not present, you will get a timeout error saying the browser could not connect to server xxx. Or the site can't be reached, or something.

I am not however much of an expert in figuring out WHY it isn't showing anything  (I used a different lib for http servers), but I am sure someone else on this list is.  I can only tell you that you probably at least launched the server correctly.

Have you tried the example on the page in the docs? (about 3/4 of the way down).
https://docs.python.org/3/library/http.server.html

If that doesn't work, it's possible you have a firewall or browser rule blocking something... and it if does work, you can look back at your code to see what might be wrong.  (I suggest playing with the log_request, log_error, and log_message parameters to figure out what is happening.)  

OF course, that all assumes that someone else smarter than I on this list doesn't come forth and just say... "well, just do this, and poof, all  will be good".

Sorry it's not more.

Dan

 

> -----Original Message-----
> From: Python-list [mailto:python-list-bounces+d.strohl=f5.com@python.org]
> On Behalf Of wrh8609@gmail.com
> Sent: Thursday, April 14, 2016 1:50 PM
> To: python-list@python.org
> Subject: Re: how to setup for localhost:8000
> 
> On Thursday, April 14, 2016 at 2:23:36 PM UTC-4, Andrew Farrell wrote:
> > What happens when you type
> >
> > http://localhost:8000
> >
> > Into the address bar of your browser as this is running?
> >
> > On Thu, Apr 14, 2016 at 12:46 PM, <wrh8609@gmail.com> wrote:
> >
> > > Hi,
> > >
> > > I am working on window 7 and Python 3.5 to setup a localhost:8000
> > > but it did not get through as shown below:
> > > > python -m http.server
> > > Serving HTTP on 0.0.0.0 port 8000 ...
> > >
> > > But it did not show the results.
> > >
> > > Can someone help me how to setup the localhost?
> > >
> > > Thanks,
> > > Wen-Ruey
> > >
> > > --
> > > https://mail.python.org/mailman/listinfo/python-list
> > >
> 
> hi Andrew,
> 
> Yes. after I type http:\\localhost:8000, the browser did not show anything
> except a empty page without any errors.
> 
> Thanks,
> Wen-Ruey
> --
> https://mail.python.org/mailman/listinfo/python-list

[toc] | [prev] | [next] | [standalone]


#107070

FromPierre Quentel <pierre.quentel@gmail.com>
Date2016-04-15 12:03 -0700
Message-ID<a5cbb46c-8d7d-482f-a608-57ba48e2df40@googlegroups.com>
In reply to#107013
Le jeudi 14 avril 2016 22:50:33 UTC+2, wrh...@gmail.com a écrit :
> On Thursday, April 14, 2016 at 2:23:36 PM UTC-4, Andrew Farrell wrote:
> > What happens when you type
> > 
> > http://localhost:8000
> > 
> > Into the address bar of your browser as this is running?
> > 
> > On Thu, Apr 14, 2016 at 12:46 PM, <wrh8609@gmail.com> wrote:
> > 
> > > Hi,
> > >
> > > I am working on window 7 and Python 3.5 to setup a localhost:8000 but it
> > > did not get through as shown below:
> > > > python -m http.server
> > > Serving HTTP on 0.0.0.0 port 8000 ...
> > >
> > > But it did not show the results.
> > >
> > > Can someone help me how to setup the localhost?
> > >
> > > Thanks,
> > > Wen-Ruey
> > >
> > > --
> > > https://mail.python.org/mailman/listinfo/python-list
> > >
> 
> hi Andrew,
> 
> Yes. after I type http:\\localhost:8000, the browser did not show anything except a empty page without any errors.
> 
> Thanks,
> Wen-Ruey

Hi,

When you type http://localhost:8000, do you see something in the console after the line  "Serving HTTP on 0.0.0.0 port 8000 ..." ?

If the server actually serves requests on port 8000 you should see a log message such as

127.0.0.1 - - [15/Apr/2016 20:57:32] "GET / HTTP/1.1" 200 -

[toc] | [prev] | [next] | [standalone]


#107130

Fromwrh8609@gmail.com
Date2016-04-16 15:35 -0700
Message-ID<67abca1d-8ac5-4a9a-825d-3aa76d9ccf3f@googlegroups.com>
In reply to#107070
On Friday, April 15, 2016 at 3:04:09 PM UTC-4, Pierre Quentel wrote:
> Le jeudi 14 avril 2016 22:50:33 UTC+2, wrh...@gmail.com a écrit :
> > On Thursday, April 14, 2016 at 2:23:36 PM UTC-4, Andrew Farrell wrote:
> > > What happens when you type
> > > 
> > > http://localhost:8000
> > > 
> > > Into the address bar of your browser as this is running?
> > > 
> > > On Thu, Apr 14, 2016 at 12:46 PM, <wrh8609@gmail.com> wrote:
> > > 
> > > > Hi,
> > > >
> > > > I am working on window 7 and Python 3.5 to setup a localhost:8000 but it
> > > > did not get through as shown below:
> > > > > python -m http.server
> > > > Serving HTTP on 0.0.0.0 port 8000 ...
> > > >
> > > > But it did not show the results.
> > > >
> > > > Can someone help me how to setup the localhost?
> > > >
> > > > Thanks,
> > > > Wen-Ruey
> > > >
> > > > --
> > > > https://mail.python.org/mailman/listinfo/python-list
> > > >
> > 
> > hi Andrew,
> > 
> > Yes. after I type http:\\localhost:8000, the browser did not show anything except a empty page without any errors.
> > 
> > Thanks,
> > Wen-Ruey
> 
> Hi,
> 
> When you type http://localhost:8000, do you see something in the console after the line  "Serving HTTP on 0.0.0.0 port 8000 ..." ?
> 
> If the server actually serves requests on port 8000 you should see a log message such as
> 
> 127.0.0.1 - - [15/Apr/2016 20:57:32] "GET / HTTP/1.1" 200 -
 Hi Pierre,

When I type http://localhost:8000, I did not see anything in the console after the line "Serving HTTP on 0.0.0.0 port 8000 ... I believe the way I ran was not correct as shown below:
> python -m http.server 
Serving HTTP on 0.0.0.0 port 8000 ...

Also if I use internet Explorer, it shows HTTP 404 errors.
Do you think the way I am doing of the localhost:8000 setting was not correct?

Thanks,
Wen-Ruey

[toc] | [prev] | [next] | [standalone]


#107179

FromMonte Milanuk <memilanuk@gmail.com>
Date2016-04-17 09:27 -0700
Message-ID<mailman.103.1460910452.6324.python-list@python.org>
In reply to#107130
On 2016-04-16 15:35, wrh8609@gmail.com wrote:

>> When you type http://localhost:8000, do you see something in the
>> console after the line  "Serving HTTP on 0.0.0.0 port 8000 ..." ?
>>
>> If the server actually serves requests on port 8000 you should see
>> a log message such as
>>
>> 127.0.0.1 - - [15/Apr/2016 20:57:32] "GET / HTTP/1.1" 200 -
> Hi Pierre,
>
> When I type http://localhost:8000, I did not see anything in the
> console after the line "Serving HTTP on 0.0.0.0 port 8000 ... I
> believe the way I ran was not correct as shown below:
>> python -m http.server
> Serving HTTP on 0.0.0.0 port 8000 ...
>
> Also if I use internet Explorer, it shows HTTP 404 errors. Do you
> think the way I am doing of the localhost:8000 setting was not
> correct?
>

Do you have any anti-virus programs running?  Its possible they may be 
interfering with letting your python installation open a server on the 
local host at all, or with letting your browser access it, if it is running.

What I get in the console looks like this:

Windows PowerShell
Copyright (C) 2015 Microsoft Corporation. All rights reserved.

PS C:\Users\Monte Milanuk> python -m http.server
Serving HTTP on 0.0.0.0 port 8000 ...

...and then once I open a browser window to 'localhost:8000', I get the 
following in the console:

127.0.0.1 - - [17/Apr/2016 09:21:49] "GET / HTTP/1.1" 200 -

Which is the python http.server telling you that it responded to a 
request from 127.0.0.1, completion code (200), etc.  If you're not 
seeing that, and you're instead getting 404 codes in the browswer 
window, something on your machine is blocking it from seeing the server.

You might try '127.0.0.1:8000' instead of 'localhost:8000' in the 
browser window, or you might try specifying different interface or port 
numbers for the server when you start it.  It *should* 'just work' as 
is, with the basic 'python -m http.server' command, but obviously it 
isn't, for whatever reason.

[toc] | [prev] | [next] | [standalone]


#107185

FromPierre Quentel <pierre.quentel@gmail.com>
Date2016-04-17 10:11 -0700
Message-ID<60e461a5-95ff-49c0-9beb-7bc595c057e1@googlegroups.com>
In reply to#107130
> > 127.0.0.1 - - [15/Apr/2016 20:57:32] "GET / HTTP/1.1" 200 -
>  Hi Pierre,
> 
> When I type http://localhost:8000, I did not see anything in the console after the line "Serving HTTP on 0.0.0.0 port 8000 ... I believe the way I ran was not correct as shown below:
> > python -m http.server 
> Serving HTTP on 0.0.0.0 port 8000 ...
> 
> Also if I use internet Explorer, it shows HTTP 404 errors.
> Do you think the way I am doing of the localhost:8000 setting was not correct?
> 
> Thanks,
> Wen-Ruey

If you're not seeing anything there, it is sure that the Python server doesn't serve requests on port 8000. But if you're seeing a blank screen or a 404 error instead of a message saying that a connection couldn't be set up, it is likely that another HTTP server is running on your machine on port 8000.

Could you try to start the server on another port, eg "python -m http.server 8085" and see what happens in the browser with "http://127.0.0.1:8085" ?

[toc] | [prev] | [next] | [standalone]


#107512

Fromwrh8609@gmail.com
Date2016-04-22 14:41 -0700
Message-ID<63f6da92-898b-4305-84ff-77cbdfa4d876@googlegroups.com>
In reply to#107185
On Sunday, April 17, 2016 at 1:11:39 PM UTC-4, Pierre Quentel wrote:
> > > 127.0.0.1 - - [15/Apr/2016 20:57:32] "GET / HTTP/1.1" 200 -
> >  Hi Pierre,
> > 
> > When I type http://localhost:8000, I did not see anything in the console after the line "Serving HTTP on 0.0.0.0 port 8000 ... I believe the way I ran was not correct as shown below:
> > > python -m http.server 
> > Serving HTTP on 0.0.0.0 port 8000 ...
> > 
> > Also if I use internet Explorer, it shows HTTP 404 errors.
> > Do you think the way I am doing of the localhost:8000 setting was not correct?
> > 
> > Thanks,
> > Wen-Ruey
> 
> If you're not seeing anything there, it is sure that the Python server doesn't serve requests on port 8000. But if you're seeing a blank screen or a 404 error instead of a message saying that a connection couldn't be set up, it is likely that another HTTP server is running on your machine on port 8000.
> 
> Could you try to start the server on another port, eg "python -m http.server 8085" and see what happens in the browser with "http://127.0.0.1:8085" ?

I followed your instruction but the page shows:
The 127.0.0.1 page isn't working

127.0.0.1 didn't send any data.
ERR_EMPTY_RESPONSE

and a lot of messages show on the command window..

[toc] | [prev] | [next] | [standalone]


#107009

FromRandom832 <random832@fastmail.com>
Date2016-04-14 14:36 -0400
Message-ID<mailman.114.1460659014.15650.python-list@python.org>
In reply to#107005
Just a note, some browsers will try to resolve this as www.localhost.com
- try http://127.0.0.1:8000 .

On Thu, Apr 14, 2016, at 14:06, Andrew Farrell wrote:
> What happens when you type
> 
> http://localhost:8000
> 
> Into the address bar of your browser as this is running?

[toc] | [prev] | [next] | [standalone]


#107011

FromChris Angelico <rosuav@gmail.com>
Date2016-04-15 04:39 +1000
Message-ID<mailman.116.1460659196.15650.python-list@python.org>
In reply to#107005
On Fri, Apr 15, 2016 at 4:36 AM, Random832 <random832@fastmail.com> wrote:
> Just a note, some browsers will try to resolve this as www.localhost.com
> - try http://127.0.0.1:8000 .

Huh? Why should the name 'localhost' get a dot com added?

ChrisA

[toc] | [prev] | [next] | [standalone]


#107024

FromVito De Tullio <vito.detullio@gmail.com>
Date2016-04-15 07:59 +0200
Message-ID<mailman.1.1460700015.6324.python-list@python.org>
In reply to#107005
Chris Angelico wrote:

>> Just a note, some browsers will try to resolve this as www.localhost.com
>> - try http://127.0.0.1:8000 .
> 
> Huh? Why should the name 'localhost' get a dot com added?

ask browser vendors...

-- 
By ZeD

[toc] | [prev] | [next] | [standalone]


#107027

FromChris Angelico <rosuav@gmail.com>
Date2016-04-15 17:38 +1000
Message-ID<mailman.3.1460705885.6324.python-list@python.org>
In reply to#107005
On Fri, Apr 15, 2016 at 3:59 PM, Vito De Tullio <vito.detullio@gmail.com> wrote:
> Chris Angelico wrote:
>
>>> Just a note, some browsers will try to resolve this as www.localhost.com
>>> - try http://127.0.0.1:8000 .
>>
>> Huh? Why should the name 'localhost' get a dot com added?
>
> ask browser vendors...

I'd more ask your local resolver. If the name 'localhost' can be
correctly resolved (it's commonly in your hosts file, and if not, your
local DNS resolver can easily be configured to be authoritative), no
additional TLD should be added ('localhost' is itself a valid TLD).

ChrisA

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web