mysql - Requested setting DATABASES, but settings are not configured error in my Django project -


i attempting change database settings in django project sqlite3 mysql.

i edited database object in settings.py file :

databases = {     'default': {         'engine': 'django.db.backends.mysql',         'name': 'identity',         'user' : 'root',         'password': ''     } } 

i ran django-admin dbshell , got error :

file "/library/frameworks/python.framework/versions/3.5/lib/python3.5/site-packages/django/conf/init.py", line 39, in _setup % (desc, environment_variable)) django.core.exceptions.improperlyconfigured: requested setting databases, settings not configured. must either define environment variable django_settings_module or call settings.configure() before accessing settings.

i followed instruction answer use settings.configure()

from django.conf import settings settings.configure() 

it returned message :

traceback (most recent call last): file "", line 1, in file "/library/frameworks/python.framework/versions/3.5/lib/python3.5/site-packages/django/conf/init.py", line 63, in configure raise runtimeerror('settings configured.') runtimeerror: settings configured.

when ran python3 manage.py shell gives me error :

file "/library/frameworks/python.framework/versions/3.5/lib/python3.5/site-packages/django/db/backends/mysql/base.py", line 28, in raise improperlyconfigured("error loading mysqldb module: %s" % e) django.core.exceptions.improperlyconfigured: error loading mysqldb module: no module named 'mysqldb'

all want use mysql instead of sqlite db.

how do ?

i think installation issues there, try follow tutorial use mysql or mariadb django , work smoothly, did here only.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -