A
A
andreyAmaterasu2020-07-27 14:37:47
Django
andreyAmaterasu, 2020-07-27 14:37:47

How to set domain name in Django project?

In settings.py, the ALLOWED_HOSTS setting is set as follows:
5f1eba7962467890341460.png
When I run "python3 manage.py runserver 0.0.0.0:8000" in the terminal, I can only go to 10.0.0.3:8000, if I enter a domain name, the browser reports that server not found. What I mean is that I can't specify a domain name in the Gunicorn config - if I specify an ip address I get into my application without any problems, but if I specify a domain name and enter it in the browser query string, then there will also be a message about that the server was not found. I can’t figure out how to correctly set the domain name so that I can enter it to go to the application?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Tikhonov, 2020-07-27
@andreyAmaterasu

Write in your computer /etc/hosts 10.0.0.3 domain_name and add domain_name to ALLOWED_HOSTS. After that, the IP address for domain_name will be found and you will be able to open your site.

D
Dr. Bacon, 2020-07-27
@bacon

The domain name is set by the web server that proxies the application to the outside.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question