pyeve / eve-demo

A fully functional REST Web API. Powered by Eve.
Other
256 stars 78 forks source link

Heroku deployment #4

Closed genkiro closed 10 years ago

genkiro commented 11 years ago

Hi,

Thank you for initiating this project.

I tried to download this eve-demo project, and I was able to run it fine using python run.py command. But it behaves weird when I run it using foreman start (this is from https://devcenter.heroku.com/articles/getting-started-with-python#procfile). All the possible links return a 404 Not Found error.

This problem also happens when we do deployment on Heroku. I thought it was a problem on the mongodb connection. So I made sure that the mongodb info on the settings.py is correct, but it doesn't fix the 404.

May I know how you deploy to heroku? Do you do foreman start when running locally?

nicolaiarocci commented 11 years ago

Hello, it looks like foreman will provide a PORT variable, which tricks settings.py into thinking it is running on Heroku. You might try changing this line into: if os.environ.get('DYNO'): and see how it goes. According to Ryan Shea DYNO is available on Heroku and not on Foreman (which makes sense). Let me know if this solves your issue: I will update the demo source accordingly.

mandarvaze commented 8 years ago

FWIW, I ran into the same issue. I know this is an old issue (closed more than 2 yrs ago, with no confirmation from @genkiro) But I'm adding this with the hope that someone finds this useful.

I am not using foreman but I get this error on "live" heroku deployment If I replace SERVER_NAME in my config.py with SERVER_URL the problem is fixed.

i.e. SERVER_NAME is no more defined (So I guess some default value is used, which works in heroku setup?) I can't remember why I used SERVER_URL instead. I am unable to remember/find the source of why this "fixes" the issue.

It worked for me twice, with the gap of 6+ months. Unfortunately I didn't document my "source" the first time. Second time (May 2016) , I just looked at my "old" git log and applied the change (somewhat reluctantly) but it worked.

May be @nicolaiarocci can add some comments on why it works.