me-wright
me-wright

Reputation: 77

Facing issue in configuring domain name to Django webserver

I have created the Django web app and deployed to ec2 instance using Nginx and supervisor it is working fine.

I bout new domain and I configured its AWS route 53. I am able to see my domain name is mapping for aws instance.

But when I try to access the Django web app it's giving 404.

I have updated the server_name parm in my Nginx config

server {
    listen 80;
    server_name equitynotify.com;

  location {
        include proxy_params;
        proxy_pass http://unix:/**/***/***/source/prod/boo-gateway/boogateway/app.sock;
    }
    location /static/ {
        autoindex on;
        alias /******/path;
}

Even I added the domain name is allowed hots of Django settings file still it's not working.

Any idea whats I am missing

Update: When I try to create one more sample app and run it port 9000 I am able to access it http://www.equitynotify.com:9000/upcomingresults/ and even if I create it the simple HTTP server 8000 port it is working, only the default 80 port is not working what may be reason

Upvotes: 1

Views: 287

Answers (1)

cagrias
cagrias

Reputation: 1847

Django's official documentation recommends adding domain names to your ALLOWED_HOSTS as www.your_domain.com if you want to specify full qualified names or .your_domain.com in order to cover both your_domain.com and www.your_domain.com. So you need to add .equitynotify.com to your ALLOWED_HOSTS.

EDIT: You also need to add your django port to the proxy_pass. If you didnt specify any custom port number, django has 8000 as its default port. Here is an example:

server {
  listen 80;

  server_name equitynotify.com;

  location / {
      proxy_pass http://localhost:8000/;
  }
}

Upvotes: 2

Related Questions