Migration from MySQL to postgresql using Django and Docker – relation “authtoken_token” does not exist

I am trying to migrate my Django project using MySQL database to postgresql with Docker. When I use MySQL everything works fine. I have all in ORM so when I use MySQL I have to create only database and do python manage.py makemigrations and then python manage.py migrate and I get ready database with all relations. As I have mentioned I’m trying to use postgresql database. Server seems to work fine using docker-compose up, but when I send for instance GET request I get:

ProgrammingError at /data
relation "authtoken_token" does not exist
LINE 1: ...user"."is_active", "auth_user"."date_joined" FROM "authtoken...

My settings:

  • Is it possible to view docker-compose logs in the output window running in Windows?
  • Which application is the docker binary from?
  • Grails 3.1.4 and Docker - grails commands return “No profile found for name web”
  • Running Spring Boot app inside Docker container, unable to connect MySQL
  • Docker - access another container on the same machine via its public ip, without docker links
  • docker push gives Failed to upload
  • DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.postgresql',
            'NAME': 'postgres',
            'USER': 'postgres',
            'HOST': 'db',
            'PORT': 5432,
        }
    }
    

    My docker-compose.yml:

    version: '3'
    
    services:
      db:
        image: postgres
      web:
        build: .
        command: python3 DIR/backend/dir/manage.py runserver 0.0.0.0:8000
        volumes:
          - .:/code
        ports:
          - "8000:8000"
        depends_on:
          - db
    

    Dockerfile:

    FROM python:3.6.1
    ENV PYTHONUNBUFFERED 1
    RUN mkdir /code
    WORKDIR /code
    ADD requirements.txt /code/
    RUN pip3 install -r requirements.txt
    ADD . /code/
    
    CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
    f364a72186ce        dockerpri_web       "python3 PROJECT/backe..."   19 seconds ago      Up 18 seconds       0.0.0.0:8000->8000/tcp   dockerpri_web_1
    774ae20bcaa3        postgres            "docker-entrypoint..."   9 hours ago         Up 19 seconds       5432/tcp                 dockerpri_db_1
    MacBook-Pro:DockerPROJECT myName$ docker exec -ti dockerproject_web_1 /bin/bash
    root@f364a72186ce:/code# 
    

  • Docker timeout while fetching image on Debian host
  • How to change the resources allocated to a container at run time?
  • Docker containers shut down after systemd start
  • Docker non-root access: Error loading config file:stat /home/wu/.docker/config.json
  • Sharing volume between docker containers
  • Eureka on docker container : unknown host exception
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.