#Django deployment onto AWS EC2 /w Nginx. Bad Request(400)

58 messages · Page 1 of 1 (latest)

stone compass
#

I'm getting a bad request(400) on my website.
I've been following this video:
https://www.youtube.com/watch?v=7O1H9kr1CsA
This video helped a lot and I got everything going, but at the end I get a bad request.
I have tried deploying my website through other means, but I got a bad request for that as well.
So I think the problem has to do with the actual django website? Maybe theres a problem with HTTP?
This is my website github repo:
https://github.com/theodorechoi123/WebsiteT
This is my first website and am still learning, but if anyone could help that would be amazing!

GitHub

Contribute to theodorechoi123/WebsiteT development by creating an account on GitHub.

pseudo sandal
#

Did you update your ALLOWED_HOSTS setting?

stone compass
#

yes

#

@pseudo sandal

#

i just did

#

i thought that was it but i still get bad request

#

and im restarting the nginx server as well

#

with the new changes

pseudo sandal
#

Did you restart the web server process like gunicorn?

stone compass
#

i didnt' try that

pseudo sandal
stone compass
#

how do i restart it?

pseudo sandal
stone compass
#

what do you mean start it?

#

start the website?

#

should i reboot the aws instance?

#

@pseudo sandal

pseudo sandal
stone compass
#

no i dont think i did that

#

oh

#

i used supervisor

#

i would have supervisor update the gunicorn.conf

pseudo sandal
#

Alright, cool. Search for how to restart a process with supervisor

stone compass
#

so I'm trying to restart gunicorn / supervisor

#

but theres a permission barrier

#

if i do : service supervisor restart

#

==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to restart 'supervisor.service'.
Authenticating as: Ubuntu (ubuntu)
Password:

#

do you know anything about this?

#

@pseudo sandal

pseudo sandal
#

You want to tell supervisor to restart specific processes, not restart supervisor.

supervisorctl restart gunicorn or something like that

stone compass
#

yea i tried that too

#

i get permission denied

#

error: <class 'PermissionError'>, [Errno 13] Permission denied: file: /usr/lib/python3/dist-packages/supervisor/xmlrpc.py line: 560

pseudo sandal
#

Odd. Without knowing more about how the server is setup I can't really help a ton

stone compass
#

i was just following the video, but it was smooth for him when he deployed it. I still get the bad request tho

#

not sure either

pseudo sandal
#

Well you need to test whether your code changes are being picked up.

#

If you're not sure, you can't reasonably debug this

#

Did you ever run the test command?

stone compass
#

do u mean the command u said?

#

i ran this

#

i think i neeed to run it again tho

#

System check identified no issues (0 silenced).


Ran 0 tests in 0.000s

OK

#

I got it working now

#

tbh im not sure how i got the server starting, but i did these commands:
sudo nginx -t
sudo service nginx restart

#

and now my website it deployed but now the problem is that the style sheet isn't changing the style of the website

pseudo sandal
pseudo sandal
stone compass
#

yeah i just did that

#

lmao

#

but i didnt add a STATIC_ROOT

#

im looking up some stuff but how would I do it for AWS?

#

is it like:

pseudo sandal
#

Use the Django storages app

stone compass
#

'/home/ubuntu/WebsiteT/src'

#

oh