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:

  • nginx php-fpm crashes (maybe docker)
  • Jenkins - Mocha tests running in docker app failing with no info
  • What are the differences between a VM image and a Docker image? [duplicate]
  • How to connect to the database in Docker in my case?
  • Changing zookeeper cluster leadership when leader dies
  • Is it possible to run my meteor tests in docker?
        'default': {
            'ENGINE': 'django.db.backends.postgresql',
            'NAME': 'postgres',
            'USER': 'postgres',
            'HOST': 'db',
            'PORT': 5432,

    My docker-compose.yml:

    version: '3'
        image: postgres
        build: .
        command: python3 DIR/backend/dir/manage.py runserver
          - .:/code
          - "8000:8000"
          - db


    FROM python:3.6.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>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

  • Docker: Why is /etc/resolv.conf unreadable? Breaks DNS [closed]
  • Set locale in Docker container
  • Cannot see Ipython notebook interface on a browser using Docker Kitematic
  • Log doesn't save to file in docker environment
  • Docker on Windows randomly crashes with 0xc0370106 when DockerFile has too many commands
  • Mesos, Docker and GRE Tunneling
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.