0

I'm trying to make the migrations between my database (MySQL) and Django. I used the same parameters in Linux and didn't have any problems. Now I'm using the command :

python manage.py migrate 

and I get nothing at all on the terminal. However, the command works if I let the default parameters ( for a sqlite database ). Also, I've noticed that it actually reads the 'settings.py' file because it returns an error if I write something that doesn't make any sense. Here are my parameters, I know for sure that they are correct ( I checked with the MySQL commands ).

settings.py

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'my_db',
        'USER': 'root',
        'PASSWORD': '123456789_dont_judge_me',
        'HOST': '127.0.0.1',
        'PORT': '3306',
    }
}

Error message

I'm using Windows 10, Python 3.5 and Django 2.0.

Do you have any idea where the problem could come from ?

Thank you for your responses kind people !

Copp
  • 83
  • 1
  • 12

1 Answers1

-1

You can try this.

Note: I am not claiming it is best solution, but it is working for me in case of Window10.

Step1 : Install pymysql

pip install pymysql

Step2: Edit settings.py

settings.py
---------------
import os
import pymysql
pymysql.install_as_MySQLdb()
import MySQLdb


# Database
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'django_test',
        'USER': 'root',
        'PASSWORD': '123456',
        'HOST': '127.0.0.1',
        'PORT': '3306',
    }
}

Step3: migrate it

python manage.py migrate

you can follow this link

Kumar Akhil
  • 176
  • 7