Sinatra app throws error when not using Shotgun

53 Views Asked by At

Context: I have a simple Sinatra app: app.rb is at the root of my project's directory, and a views/ directory sits at the same level as app.rb.

When I run my app with ruby app.rb, it throws an error in which it appears that Sinatra doesn't know where the views/ directory is:

Errno::ENOENT at /
No such file or directory @ rb_sysopen -
/{Two Directories Above Project Root}/views/admin.erb

For some reason, Sinatra seems to think the root of my project is two levels above where it actually is, and I can't figure out why. When I set the views folder explicitly, this error goes away, but other aspects of my application breaks because my app doesn't appear to know where it lives.

When I run the app with shotgun, I don't get this error. I'm using shotgun for now, so it's not a big deal. I'm just trying to nail down why this behavior is occurring.

0

There are 0 best solutions below