Question

Server error during upload(500)

Hello fellow humans.

I finally deployed my app after following the tutorial how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04 but when i try to upload a file on the site as a user, i get server error (500). Wht do I have to do to remedy the problem as soon as possible??

will appreciate your assistance

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

@iknwosu3

Do you get any errors? If yes, is it from Nginx or Gunicorn? Show the last lines from the log. What’s the output of this?

ls -l /home/kingiyk/stylplus/media/name-of-some-file-you-just-uploaded

@iknwosu3

Okay, change current log level to debug, by adding this parameter:

--log-level debug

http://docs.gunicorn.org/en/stable/settings.html#loglevel

There’s something wrong with your upload-code or maybe you try save the uploaded file to a place where there’s no permissions, which somehow is crashing Gunicorn.

@iknwosu3

Change it do this:

ExecStart=/home/kingiyk/stylplus/env/bin/gunicorn --error-logfile /var/log/gunicorn.log --access-logfile - --workers 3  --bind unix:/home/kingiyk/stylplus/stylplus.sock stylplus.wsgi:application

Restart Gunicorn sudo service gunicorn restart Try to upload, so you get the error and then check /var/log/gunicorn.log

Hi @iknwosu3

Can you show the log both Gunicorn and Nginx?

tail -20 /var/log/nginx/error.log
tail -20 /path/to/gunicorn.log