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:

  • docker percheron volumes not mounting and containers not starting
  • Pycharm docker remote python interpreter
  • How to develop Rails app running inside Docker
  • Run dockerd as with non-default group in centos6 as a service?
  • Docker pid namespace and Host
  • Pulling docker images
  • 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-compose.yml for elasticsearch and kibana
  • Is there a way to build docker image from two jars such as each jar locates in it's own layer
  • consul-template using Address not ServiceAddress in template
  • Possible to use Docker machine with continuous integration tools?
  • Increase the disk size of docker (Error: Insufficient space)
  • Is there any way to “apply a patch” to a docker image?
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.