I have successfully deployed my website to digital ocean, however I am not able to log users in. It seems to be breaking with a server 500 error. GET requests from my api are working I believe just not POST. I am using Django Rest framework on the backend and vue for the frontend. Here is my backend .conf file :
upstream relate_app_server {
server unix:/webapps/relate/env_3_8/run/gunicorn.sock fail_timeout=0;
}
server {
listen 80;
server_name api.relatestudy.com;
client_max_body_size 4G;
access_log /var/log/nginx/api-access.log;
error_log /var/log/nginx/api-error.log;
location /static/ {
alias /webapps/relate/env_3_8/relate_django/static/;
}
location /media/ {
alias /webapps/relate/env_3_8/relate_django/media/;
}
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://relate_app_server;
}
}
and my front.conf file:
server {
listen 80;
server_name relatestudy.com www.relatestudy.com;
root /webapps/relate/relate_vue/dist;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}
Here is my settings.py:
ALLOWED_HOSTS = ['api.relatestudy.com']
WEBSITE_URL = 'http://api.relatestudy.com'
CORS_ALLOWED_ORIGINS = [
'http://www.relatestudy.com',
]
CSRF_TRUSTED_ORIGINS = [
'http://www.relatestudy.com'
]
Does anyone have any ideas what might be happening? Any help would be really appreciated. Im not really getting anywhere with this…
This textbox defaults to using Markdown to format your 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.
Hi @littleturquoiseanemone,
Can you please check your Error Log and see the exact error behind the POST request for logging in? It would be either in Nginx or in Django’s logs.