getting ConnectionDoesNotExist error when attempting to migrate mysql database in django - python

here's my code in django settings.py for the database:
DATABASES= {
'defualt': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'cameronkc',
'USER': 'root',
'PASSWORD': '123456',
'HOST': 'localhost',
'PORT': ''
}
}
here's the error im recieving when executing >python manage.py migrate in command prompt
django.db.utils.ConnectionDoesNotExist: The connection default doesn't exist

You misspelled default in your DATABASES dict. Change 'defualt' to 'default'.

Related

Error while switching the database from sqllite to postgre django

I changed the values of the DATABASE variable in the file settings.py to
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'postgres',
'USER': 'postgres',
'PASSWORD': 'password',
'HOST': 'localhost',
'PORT': "5432"
}
}
but now after i run python manage.py migrate i'm getting the error
django.db.utils.ProgrammingError: column "name" of relation "django_content_type" does not exist
can someone tell what this error means and how to fix it
I figured it out. This occurred because i had to databases sharing the same name. If you came across the same error check that

Python manage.py migrate error when changing database from sqlite to mysql

I just started learning django. I change the following settings from setting.py because I want to use mysql not sqlite:
DATABASES = {
'default' : {
'ENGINE' : 'django.db.backend.mysql',
'NAME' : 'newprj',
'USER' : 'root',
'PASSWORD' : 'abcd',
'HOST' : 'localhost',
'PORT' : ''
}
}
then when I try this code python manage.py migrate on cmd. It throws an big error, I can't understand what is the problem, please help me solve it. This is the error:
You missed the s in django.db.backends.mysql
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', #<---- You missed the s in backends
'NAME': 'myproject',
'USER': 'myprojectuser',
'PASSWORD': 'password',
'HOST': 'localhost',
'PORT': '',
}
}

django.db.utils.OperationalError: FATAL: database "clinilead_e " does not exist

After changing the db from sqlite to postgresql(python manage.py makemigrations)running, I am getting this error.How could i overcome this?
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'clinilead_e ',
'USER': 'postgres',
'PASSWORD': 'password',
'HOST': '127.0.0.1',
'PORT': '5432',
}
}
In postgres, unlike sqlite you have to create the database.
$ createdb clinilead_e

django.db.utils.operationalerror: <2006, "Access denied for user 'root'#'localhost' <using password: YES>"

i used the command python manage.py migrate and the project settings.py are as follows:
DATABASES = {
'default':{
'ENGINE': 'django.db.backends.mysql',
'NAME': 'timesheetdb',
'USER': 'root',
'PASSWORD': '123456',
'HOST': 'localhost',
'PORT': ''
}
I am getting an error of:
django.db.utils.Operationalerror:<2006,"access denied for user'root'#'localhost' ".
i get the same error with the command python manage.py runserver
Can you help?

Why I cannot create a database for graphite-web?

I am trying to install graphite-web on my computer by following the instructions on
https://gist.github.com/surjikal/2777886. When I try to populate the database with manage.py syncdb it does not find a proper database throwing the following error:
> sudo python manage.py syncdb
OperationalError: FATAL: database "/opt/graphite/storage/graphite.db" does not exist
Here you can find my database configuration from local_settings.py:
DATABASES = {
'default': {
'NAME': '/opt/graphite/storage/graphite.db',
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'USER': 'graphite',
'PASSWORD': '<password>',
'HOST': 'localhost',
'PORT': '5678'
}
}
Postgres is running properly:
sudo service --status-all | grep postgres
...
[ + ] postgresql
Why manage.py syncdb cannot create / find the graphite.db file?
If you are using postgresql then database path will not be required. You just need database name. like
DATABASES = {
'default': {
'NAME': 'graphite',
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'USER': 'graphite',
'PASSWORD': '<password>',
'HOST': 'localhost',
'PORT': '5678'
}
}

Categories

Resources