-1

Say I have the domain mydomain.com and I want www.mydomain.com to display my Django site

I have looked at the django docs but the answers they provide are confusing

what DNS records do I need to set to allow this? and are there any changes that have to be made to the config

note: I'm using ipv4 and am running ubuntu

mmoomocow
  • 1,173
  • 7
  • 27

2 Answers2

0

You should make an A/AAAA record for the www subdomain that points to your server IP

Depending on the web-server you are using (for example Apache or Nginx) you can change the config to send traffic from the www subdomain to the Django server.

ToTheMax
  • 981
  • 8
  • 18
  • so how do I get it to use a port? because it runs on port 8000 and if i just use the IP address it doesn't work – mmoomocow Apr 13 '20 at 12:18
  • That's where a web-server is needed. It can forward traffic (proxy) with a specific domain to a specific port of the machine. For example nginx: https://stackoverflow.com/questions/24861311/forwarding-port-80-to-8080-using-nginx – ToTheMax Apr 13 '20 at 12:22
0

It sounds like you are serving your project with the development server which runs on port 8000. You first need to run it with apache2 or nginx on port 80 (https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/modwsgi/), then set up your dns record to point to the ip address of your server

Job254
  • 16
  • 2