It's a mystery that this article is still being read, but I wrote the following blog article before, so please read this
Let's stop using PyMySQL with Django
$ pip install PyMySQL django
$ django-admin.py startproject <project_name>
$ django-admin.py startapp <app_name>
<project_name>/settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'dbname',
'USER': 'dbuser',
'PASSWORD': 'password',
'HOST': '',
'PORT': '',
}
}
manage.py
import pymysql
pymysql.install_as_MySQLdb()
$ python manage.py makemigrations
$ python manage.py migrate
$ python manage.py createsuperuser
$ python manage.py runserver
Recommended Posts