I have a Django account, where there is only one user for the entire app. I also have not setup admin for this app.
The problem is, when I first start my docker container for the Django app and type in my domain, I am already logged in. Even if I open this in a private window or another browser (Firefox; I normally use Chrome), the issue still remains.
This is the script to create the user:
from django.contrib.auth.models import User
import os
# Create user and save to the database
if User.objects.exists():
print("user already exists")
else:
username = os.environ.get("USER_USERNAME")
email = os.environ.get("USER_EMAIL")
password = os.environ.get("USER_PASSWORD")
if not username or not email or not password:
print("user information not supplied. please check your .env that USER_USERNAME, USER_EMAIL, USER_PASSWORD are all set.")
User.objects.create_user(username, email, password)
print("created user")
This is called from docker-compose.yml like this:
services:
web:
build: .
command: >
bash -c "mkdir -p static
&& python manage.py collectstatic --no-input
&& python manage.py migrate
&& python manage.py shell < init/create_user.py
&& $$RUN_SERVER_COMMAND"
Why does this happen? Is there a setting to turn off "logged in by default"?