'Django aws getting mysql OperationalError

I was using localhost mysql database. After integrating aws rds mysql I am getting this error django.db.utils.OperationalError: (1071, 'Specified key was too long; max key length is 3072 bytes')

Here is my mysql configuration for aws rds:

settings.py

DATABASES = {
    'default': {
        'ENGINE': config('AWS_MYSQL_ENGINE'),
        'NAME': config('AWS_MYSQL_DB_NAME'),
        'USER': config('AWS_MYSQL_DB_USER'),
        'PASSWORD': config('AWS_MYSQL_DB_PASSWORD'),
        'HOST': config('AWS_MYSQL_DB_HOST'),
        'PORT':config('AWS_MYSQL_DB_PORT'),
    }
}

my local host mysql is working fine. I am not understanding why I am getting this error after move to aws rds. I am straggling from several hours for solve this problems. I tried to run migrate after delete all of my migrations files but didn't work.

here is full error log:

site-packages\MySQLdb\connections.py", line 254, in query        
    _mysql.connection.query(self, query)
django.db.utils.OperationalError: (1071, 'Specified key was too long; max key length is 3072 bytes')  


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source