Ok I’ll try again.
I’m using Visual Studio Code with a Dockerfile and docker-compose file. To compose the docker, I have a simple right-click on the docker-compose.yml file which opens up a menu with “Compose Up” and that’s how I launch the Docker. There is also “Compose Down” and “Compose Restart”.
I have one database that I fill up with API requests with a button click as well as the default database.
DATABASES = {
'data': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': '../data.sqlite3',
},
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': '../auth.sqlite3',
}
}
I can show you the way I fill it up but it takes about 400 lines of code so I’ll abstain for now. And I had to create a volume for data.sqlite3 since I need data to persist.
When I run the Docker Compose Up, I access the website and do everything I want it to do. No errors. Now, I would like to add users and login to restrict access to some data of the data.sqlite3 database.
Since the template as started with used had an authentication app with login and register pages, as well as working code to authenticate, I want to use those. I am able to create a user from these views and login using the user created like so (until I restart the Docker). However, I need to create users and permissions. I tried hardcoding a user into the authentication/models.py file:
user = User.objects.create(username='test', email='test@test.com', password='test')
user.is_superuser = True
user.is_active = True
user.is_staff = True
user.save()
However, it I can’t actually login to my site with this user. To try and correct this, I decided to use
python manage.py createsuperuser
and created a superuser successfully. Then I used “Docker Compose Up” (through the right click menu) and went to the “localhost:5005/admin/” page to try and login using that super user I had just created. It did not work. I get the following screen:

Following this, and with some research on Internet, I tried using
python manage.py runserver
and went to " http://127.0.0.1:8000/admin/". There I tried to login using the super user created earlier. This worked and I was able to see Users and Groups. I could also see the user “test” I had hardcoded previously.
I then created a second test user “test2” within the admin page.
I then used Docker Compose Up again and tried to login (to my website) with “test2” but to no avail.
Since the app “authentication” wasn’t in the list of INSTALLED_APPS, I tried adding it to there, maybe the problem had something to do with migrations. However, when I used Docker Compose Up, I got an error during the migrations for the app “authentication”.
#11 0.526 Traceback (most recent call last):
#11 0.526 File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
#11 0.526 return self.cursor.execute(sql, params)
#11 0.526 File "/usr/local/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py", line 383, in execute
#11 0.526 return Database.Cursor.execute(self, query, params)
#11 0.526 sqlite3.OperationalError: no such table: auth_user
I also have another app “app” with has everything related to my website, other than authentication (and contains the data.sqlite3 database). To be able to use the manage.py createsuperuser
command I had to create a virtual environment so I have a folder with that, on top of the .env file that came with the template.