Long story short, I created a django project and used the django for professionals book 2.2 as a reference(Made a couple more fields in the models). However, once I reached the security chapter and tried running the docker commands in the terminal, I get a programming error.
After researching and trying to debug, I decided to delete all migrations from the project, the volume from the docker container, and delete/comment out certain files/code.
From here, I reran all the migrations and now when I check my terminal, I still get 21 unapplied migrations and "Starting development server at http://0.0.0.0:8000/". When I click on the link, I get the "Disallowed Host at / ...Invalid HTTP_HOST header:..."
I am just wondering what went wrong because it seems to me that my docker-compose.yml and settings.py seems to be contributing to this error. I am trying to get my terminal to get the link to "https://127.0.0.1:8000/".
settings.py: I am using the postgres database
DEBUG = int(os.environ.get('DEBUG', default=0))
ALLOWED_HOSTS = []
docker-compose.yml: I left out the secret key
version: '3.8'
services:
web:
build: .
command: python /code/manage.py runserver 0.0.0.0:8000
environment:
- DEBUG=1
- ENVIRONMENT=development
volumes:
- .:/code
ports:
- 8000:8000
depends_on:
- db
db:
image: postgres:12.3
volumes:
- postgres_data:/var/lib/postgresql/data/
volumes:
postgres_data:
Sidenote: Prior to deleting the programming error, and deleting the migrations, I was able to get the 127.0.0.1:8000 to work even though I had 0.0.0.0:8000 in my docker-compose.yml.
Any help is greatly appreciated.