Hey all, I am having trouble with getting URL templates to work on localhost as well as on the actual domain. They work fine on the actual domain but when I run it on localhost it keeps redirecting to / instead of .localhost:8000. Is there a way to fix it so the URLs route to localhost in development and to the actual domain in production?
Now, as said above, the href redirects to ar-demo..com on the actual domain. But it redirects to http://ar-demo/ when it runs on localhost. The expected behavior is a redirect to ar-demo.localhost:8000.
Is there a way to fix the URL templates so it works both scenarios like the normal Django URL templates?
Just found it;
Adding PARENT_HOST = 'localhost:8000' fixes it local, it should be the domain name on production. I will close the issue but not remove it so others might refer to it later.
Hey all, I am having trouble with getting URL templates to work on localhost as well as on the actual domain. They work fine on the actual domain but when I run it on localhost it keeps redirecting to/ instead of .localhost:8000. Is there a way to fix it so the URLs route to localhost in development and to the actual domain in production?
Files: settings.py
hosts.py
ar-demo urls.py
index.html
Now, as said above, the href redirects to ar-demo..com on the actual domain. But it redirects to http://ar-demo/ when it runs on localhost. The expected behavior is a redirect to ar-demo.localhost:8000.
Is there a way to fix the URL templates so it works both scenarios like the normal Django URL templates?