InterviewSolution
| 1. |
Can I Connect MySQL to Django? |
|
Answer» Below are the supported and tested versions of Django-MySQL’s requirements:
Before setting connection below prerequisite is taken into consideration- 1. MySQL is INSTALLED Now let us see the STEPS to connect to MySQL - 1. Open settings.py from the directory of the Django project. 2. Update the DEFAULT key in the DATABASE dictionary. Set ENGINE, NAME, USER and PASSWORD you choose when installing MySQL. # Database # HTTPS://docs.djangoproject.com/en/2.0/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'djangoApp', 'USER':'root', 'PASSWORD':'mysql', 'HOST':'localhost', 'PORT':'3306' }, }3. Open a command window and activate a virtual environment and change it to Django project directory. If there is no error your connection between Python, Django, and MySQL is successful. |
|