I have bumped into the following problem and still don't know how to fix it. For the record I am using mac.
I would like to connect my djnago app to an elephantsql database, so I have changed the database info.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'abc',
'USER':'abc',
'PASSWORD':'password',
'HOSTS':'tai.db.elephantsql.com',
'PORT': 5432
}
}
I see my database working fine in pgAdmin 4, so there is no issue with that, but when I run
python manage.py migrate
got the following error:
django.db.utils.OperationalError: FATAL: password authentication failed for user "abc"
Do you have any tips how to go forward?
You specify the host of the database with the HOST key, not the HOSTS for the DATAbASES setting [Django-doc]:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'abc',
'USER': 'abc',
'PASSWORD': 'password',
# ↓ HOST instead of HOSTS
'HOST': 'tai.db.elephantsql.com',
'PORT': 5432
}
}
Related
I tried to deploy my application on AWS, but I'm having problems!
First, when trying to put MySQL data in settings.py, a problem appears:
"Unknown MySQL server host 'myapp.us-east-1.rds.amazonaws.com'
I tried with other databases (Postgresql and Oracle) and they worked, but mysql did not.
Does anyone know how to solve? I would be grateful. Gratitude.
Please confirm, your setting file should be like below:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'xxx',
'USER': 'xxx',
'PASSWORD': 'xxx',
'HOST': 'xxx.xxx.us-east-1.rds.amazonaws.com',
'PORT': '3306',
}
}
I have 2VM. One is the "Apache+Django" server and one Mysql server.
I want to know that How connect the Django and externel mysql ?
Change below setting in your settings.py file
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'mydb', # remote db name
'USER': 'root', # remote db user
'PASSWORD': 'mypass', #remote db pass
'HOST': 'remote.ip.address.something',#remote ip or url
'PORT': '3306', # remote post
}
}
What I'am trying to do is to use 2 databases in my django app. One is to be accessed from a remote server. Django settings has something like this
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'snackvoxadmin'
},
'users': {
.....
}
}
The database user has a url like similar to this one: postgres://a78adj1he81....
You can decompose your database url and configure it like this:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'mydatabase',
'USER': 'mydatabaseuser',
'PASSWORD': 'mypassword',
'HOST': '127.0.0.1',
'PORT': '5432',
}
}
And the pattern for a database url is :
postgres://user:password#host:post/database
https://docs.djangoproject.com/en/1.8/ref/settings/#databases
Or you can use the package dj-database-url to directly use the database url.
E.g. from readme :
import dj_database_url
DATABASES = {'default': dj_database_url.parse('postgres://...')}
That URL presumably consists of a username, a password, and a host name/IP address. You could split them up yourself or use the dj-database-url library.
I'm newbie with python and django,
Im trying to setting up Django in windows7,
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': os.path.join(BASE_DIR, 'amour'),
'USER': 'openpg',
'PASSWORD': 'openpgpwd',
'HOST': '127.0.0.1',
'PORT': '5432',
}
}
when trying to execute the server: python manage.py runserver
the below error appear :django.db.utils.OperationalError: FATAL: database "Path" doesn't exist
I already install PostgreSql 9.3 and Python 2.7.
You should pass the name of the database, not the filename. So if you created database named "amour" then setting will be:
DATABASES = {
'default': {
...
'NAME': 'amour',
...
}
}
I'm trying to configure the postgresql in django project, here is my settings
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'newdb',
'USER': 'vishnu',
'PASSWORD': 'dsvv',
'HOST': 'localhost',
'PORT': '',
}
}
when I run syncdb command it gives the error "OperationalError: FATAL: Ident authentication failed for user "vishnu"". I tried the answers given in this link
"psql: FATAL: Ident authentication failed for user "postgres"" as well several other links but its still giving me the error.
what is the problem how can I fix it?