You should consider that in order for your environment variables to be available to your docker-compose.yml file they need to be called from the same terminal where you exported DJANGO_ALLOWED_HOSTS.
You need to source your env file before you call:
docker-compose up -d
Once you’ve done that, run the following:
set -a
source .my-env
docker-compose up -d
If you’re still getting an error, I suggest you use tox and post back.