how to setup for localhost:8000

Monte Milanuk memilanuk at gmail.com
Sun Apr 17 12:27:38 EDT 2016


On 2016-04-16 15:35, wrh8609 at 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.




More information about the Python-list mailing list