Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby Building Web Apps with Sinatra ERB Templates Getting HTML from a Template

Kevin Schaffter
Kevin Schaffter
927 Points

Preview Function not working

I can't use the "preview" function to see my sinatra app... it just says it is not active even though I've made sure the workspace is up to date.

Any ideas?

1 Answer

Jay McGavren
STAFF
Jay McGavren
Treehouse Teacher

I'm able to get a preview going by following these steps:

  • Visit https://teamtreehouse.com/library/getting-html-from-a-template. (These general steps should work anywhere in the course, but that's the video linked from this Community post.)
  • Click "Launch Workspace".
  • From the console, run ruby wiki.rb, and leave it running.
  • Click the "preview" icon, and choose port 4567. (This is important, because that's the port Sinatra listens on by default. It won't connect if you choose a different port.)

If you do that, a window should pop up showing "Welcome to our Wiki!".

If you're trying to run an app you've created yourself, make sure you've included set :bind, "0.0.0.0" in the source. It would help us diagnose the problem if you could post your full source code here.

If you're still having trouble, please let us know!

Kyle Shamblin
Kyle Shamblin
9,945 Points

I'm also having this issue.