[Solved]-Starting Django with docker unexpected character

2πŸ‘

βœ…

(Sorry about the answer – I don’t yet have the rep to comment)

Just want to add a note on to the answer by D.Mo – I had the same error this morning, and adding quotes around the values in my .env file did seem to resolve the issue.

Though I then noticed that in the documentation for these env files, Docker mentions

There is no special handling of quotation marks. This means that they are part of the VAL.

Just wanted to point that out in case anyone ran into issues with this.

I will likely just keep this change locally until others in my team experience the same problem – unless someone can confirm that the ENV values should now have ""s around them.

FWIW I could not find a way to disable Docker Compose V2 (I’m on Arch, Docker v20.10.9) – docker-compose disable-v2 isn’t a valid command for me (see here for what I assume is the (imo silly) reason).


Edit – I ended up reverting to a previous version of docker-compose as the constant workarounds I had to implement weren’t fun.
I did so after seeing this – I ended up looking around yay -U /var/cache/pacman/pkg/docker-compose- and tab-complete gave me a list of cached versions. I went with 1.29.2-1 and things have been working perfectly again since then. Will just have to see what happens in future updates etc.

πŸ‘€Staindk

18πŸ‘

Turning off the "Use Docker Compose V2" flag in the settings did it for me.

5πŸ‘

I had a similar problem with a docker container. It probably appears after a system update under my linux. I can’t say anything about the reason, but try following:

Quote the variable values in file ".env" of the Project, such as:

DEBUG=0
SECRET_KEY=foo
DJANGO_ALLOWED_HOSTS="localhost 127.0.0.1 192.168.2.253"
DJANGO_SETTINGS_MODULE="djdict.settings_prod"


SQL_ENGINE="django.db.backends.postgresql"

# ...

And try again

πŸ‘€D.Mo

3πŸ‘

Look at the "Use Docker Compose V2" option.
It seems it’s ON now

πŸ‘€user13813300

2πŸ‘

I changed Encoding of my .env file to UTF-8.
Earlier it was UTF-8-BOM and that caused the problem.

πŸ‘€NIkolai

0πŸ‘

For me running
docker-compose disable-v2
fixed the issue

πŸ‘€Leo

0πŸ‘

For latest mac M1. Use the UI to disable

Use Docker Compose V2

or in terminal
docker-compose disable-v2

πŸ‘€Gathiira M.

Leave a comment