3

I am attempting to deploy a flask webapp on digital ocean, but I keep getting "internal server error" whenever I attempt to do anything involving POST requests (such as logging in or registering). The app works fine when I run it using flask's built-in server.

I used parts 1 & 2 in this tutorial to set it up, with the exception of replacing flask_project with the name of my project, and newuser with my username. Does anybody know how I can fix this, or at the very least, go about diagnosing the problem? Are there error logs somewhere?

I notice the sample app used in the example only uses GET requests, which work fine. My guess is that I need to do configuration slightly differently in order to get POST to work as well. However, I can't find any tutorials on how to properly do this.

Thanks in advance

Update: So I wiped the sever clean and started over, this time using this tutorial on how to deploy on apache. Still having the same problem.

quantumbutterfly
  • 1,815
  • 4
  • 23
  • 38
  • 1
    Error might be related to what you are doing in the post message. Perhaps use a try: except block to capture all exception, and return the error might help you debug this. – tourdownunder Feb 14 '15 at 02:55
  • 1
    I know the actual POST message isn't the issue because it works flawlessly when I run it using flask's internal server. Only when I try to do it through nginx do I get an error. This means there is something wrong with my nginx configuration that's causing to not pass PST requests it receives to gunicorn properly. Only, I don't know how to correctly configure it – quantumbutterfly Feb 15 '15 at 02:34
  • @quantumbutterfly I just ran into a ton of these problems with nginx, flask and uwsgi. Can you put up your virtual server files? That way we can take a look and maybe help out a bit more. – SJoshi Feb 15 '15 at 16:18
  • @SJoshi Where do I find my virtual server files? – quantumbutterfly Feb 15 '15 at 21:02
  • @quantumbutterfly could be still permissions related. I discovered this when I had this issue with my servers (not digital ocean) until I created an user and group www http://stackoverflow.com/a/27221427/567606 Is this POST function writing anything to disk? – tourdownunder Feb 15 '15 at 22:18
  • @darwindave when I run `sudo adduser www -g www`, I get `Option g is ambiguous (gecos, gid, group)` Any ideas? – quantumbutterfly Feb 16 '15 at 00:33
  • @quantumbutterfly did you complete the sudo groupadd www first. Did you choose to rename the group id (gid) to something else? – tourdownunder Feb 16 '15 at 00:48
  • @darwindave yes, I did. So from reading the help, I found out users are added to groups without the -g flag. I ran the command `sudo adduser myusername www' and then `sudo chown -R myusername:www /var/www`, but that did not solve the issue – quantumbutterfly Feb 16 '15 at 00:52
  • @quantumbutterfly I think you need to configure logging. I just used the mail logger like demonstrated in https://github.com/miguelgrinberg/flasky . Look at config.py for the details under production config it will set up the email logging. – tourdownunder Feb 16 '15 at 02:02
  • @quantumbutterfly your nginx virtual servers tend to be in something like /etc/nginx/sites-available/ – SJoshi Feb 16 '15 at 03:08

0 Answers0