szym / display

Lightweight browser-based display server
MIT License
212 stars 46 forks source link

display not working on localhost -- only showing json info, but not image #20

Closed suryabhupa closed 8 years ago

suryabhupa commented 8 years ago

In following the tutorial on the README, when the display function runs, but only is outputting the json: data: {"content":{"file":[[0,-1.2920932073243],[1.1111111111111,-1.0734784297415],[2.2222222222222,0.27885892990331],[3.3333333333333,-0.12175768971955],[4.4444444444444,0.16801618442082],[5.5555555555556,0.011533429745621],[6.6666666666667,0.83489397687172],[7.7777777777778,0.031249044780407],[8.8888888888889,0.23550898868986],[10,-0.6444625754049]]},"command":"pane","id":"pane_145713209407532286166836","type":"plot"}

Is there something that's happening, and something I can do to resolve this? This same issue is also happening when running MazeBase from Facebook -- it shows the json, and not the actual images.

szym commented 8 years ago

I'm not sure what MazeBase is.

Can you help me figure this out? Which step in the tutorial produces the output?

suryabhupa commented 8 years ago

I first ran:

th -ldisplay.start 8000 0.0.0.0

and on a separate terminal, I ran this:

th example.lua

to which the output in localhost:8000/events is:

data: {"title":"lena","content":{"src":"data:image\/jpg;base64,\/9j\/4AAQSkZJRgABAQAAAQABAAD\/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL\/2wBDA...

Basically, the json isn't being decoded, and it's just a big dump of the base64 information of the image.

soumith commented 8 years ago

where exactly did you read that you should open localhost:8000/events ?

suryabhupa commented 8 years ago

In the terminal where I ran the start to the server, it printed out lines like:

POST /events POST /events POST /events POST /events POST /events POST /events GET /

so I assumed the images were being posted there, and I only see the dumps. Otherwise, if I keep localhost:8000 open while running th example.lua, it just says "Not found!" Am I missing a step somewhere?

soumith commented 8 years ago

the README quickstart says https://github.com/szym/display#-quick-start

Then open http://(hostname):(port)/ in your browser to load the remote desktop.

try that.

soumith commented 8 years ago

if that says Not found! that seems to be a problem. you should see the display webpage, and when events happen, you see images, plots etc.

suryabhupa commented 8 years ago

Yeah, it seems like whenever I start the server, it just says "Not found!" on localhost:8000. Do you think there's some configuration error? When I try to use Mazebase, the same issue happens (which I assume is because this isn't working either).

This is happening on my friend's computer as well, and she is following the same setup.

soumith commented 8 years ago

try to change the port and see what happens. maybe there's something else running on localhost:8000

Also, what browser are you opening this in? And what folder are you running this from?

suryabhupa commented 8 years ago

I just changed it to localhost:2345 and localhost:4567, and tried it on Safari and Google Chrome, and it's still saying "Not found!" I'm running this from the root of the display repo. Should I try from elsewhere?

soumith commented 8 years ago

try it from another folder, other than from the root of the display repo. try it from your home directory or something.

soumith commented 8 years ago

i cant reproduce your issue though, weird.

szym commented 8 years ago

"Not found" is a strange result given that http://localhost:8000/events seems to work as expected (though it is not meant to be opened by the user).

Try opening http://localhost:8000/index.html

szym commented 8 years ago

Ah, now I see what could be causing it. Maybe sys.fpath() does not work as expected?

szym commented 8 years ago

OK I think thus is the bug. Server.lua concatenates sys.fpath() with '/static'. Surprised I didn't catch it.

szym commented 8 years ago

That should fix it. Can you try with the new HEAD?

suryabhupa commented 8 years ago

Gah, it still says "Not found!" :/ Even opening localhost:8000/index.html shows the same message.

Just to make sure we're on the same page, I'm running th -ldisplay.start 8000 from my home directory, trying to go to localhost:8000, and this is the message.

soumith commented 8 years ago

try: luarocks install display That will update your installed display to head

suryabhupa commented 8 years ago

Yeah, I pulled the repo and did luarocks install display, but the same is showing up here and on my friend's computer.

soumith commented 8 years ago

oh god, yea i'm sorry just got a repro. will fix in a sec.

suryabhupa commented 8 years ago

Haha, whew -- I really thought my setup was just completely whack. Hopefully it works out.

soumith commented 8 years ago

sent a PR #21 to fix it.

If you want to try it immediately:

cd /tmp
git clone https://github.com/soumith/display -b fixpaths
cd display
luarocks make
cd
th -ldisplay.start
suryabhupa commented 8 years ago

It seems to still suffer from the same problem even after pulling from luarocks install display :/ Running th -ldisplay.start 8000 0.0.0.0 still shows "Not found!" on 0.0.0.0:8000.

suryabhupa commented 8 years ago

Are there any other dependencies that I should have?

soumith commented 8 years ago

try it again now. (had to update the rock https://github.com/torch/rocks/commit/7ff94c566e15eabe03465b3202deed46bf9dc133 )

luarocks install display th -ldisplay.start

suryabhupa commented 8 years ago

It works! :+1: Thank you so much for all of this.