Password authentication failed when trying to run django application on server - python

I have downloaded postgresql as well as django and python but when I try running the command "python manage.py runserver" it gives me an error saying "Fatal: password authentication failed for user" . I am trying to run it locally but am unable to figure out how to get past this issue.
I was able to connect to the server in pgAdmin but am still getting password authentication error message

You need to change the password used to connect to your local Database, and this can be done, modifying your setting.py file in "DATABASES" object

Related

Error: 'no pg_hba.conf entry for host' using Django with PostgreSQL?

I am building a web app using Django. I am trying to connect the app to the Azure Database for PostgreSQL.
When I try to make migrations with the command, python manage.py makemigrations from PowerShell, I'm getting this error:
no pg_hba.conf entry for host
What does this error mean?
This error means you've haven't configured PostgreSQL correctly for the user you are trying to connect from Django with.
pg_hba.conf is the PostgreSQL file which contains PostgreSQL users, where from, and how they are able to connect. See here for more details:
https://www.postgresql.org/docs/12/auth-pg-hba-conf.html
You should get the same error when you try to run any Django command which needs to connect to the database, for example, python manage.py dbshell. Good luck!

Heroku Maintenance has changed my DATABASE_URL I have access to a foreign DB

I am using heroku for 3 years now. And today for one of my app I recieved first time a "Maintenance (DATABASE_URL on my-project) has completed successfully." email.
But my site is completely down with this error:
Aug 21 19:55:16 my-project app[web] FATAL psycopg2.OperationalError: FATAL: password authentication failed for user "kfwefwfcwere"
Aug 21 19:55:16 my-project app[web] FATAL FATAL: password authentication failed for user "kfwefwfcwere"
So I am trying to figure out whats wrong and I see that my DATABASE_URL is a new one which is not mine. I also cant change it, because I get:
Cannot overwrite attachment values DATABASE_URL.
What do I do now? Someone had this before?
EDIT
I checked through pgAmdin whether I really have access to a foreign DB and it seems no, I get the same error there:
password authentication failed for user "kfwefwfcwere"
Okay I found the issue. It seems that this is new in heroku for hobby, dev and standard tiers. In the maintenance heroku changes the DB credentials for your DB and it should update the config var automatically but in my case it failed and my site was down.
I was confused because when I checked my DB credentials through the heroku website it still showed me my old credentials, so it looked like I had access to a foreign DB.
The biggest issue was ofc. that my site was down for several hours until I noticed.
I simply had to change in my config.py the DATABASE_URL to the new one, which I found in heroku config

Django-nodejs-ishoutjs-redis: IntegrityError: UNIQUE constraint failed: auth_user.username

My goal is to build a realtime notification app using Django(1.8.5). I am using django server, Nodejs as push server, ishout.js[nodejs+redis +express.js API]. So I installed them by following the instructions.
I have build the whole project, Kindly suggest how it can be fixed
Error:1) Now when I am doing "$ python manage.py shell" , I get this error http://pastebin.com/DnGjpYEn
Actually by mistake I entered wrong password in first attempt, username was correct but password parameter got wrong, Now can I reset that to avoid the error depicted in pastebin above. By any ways and means can I repeat that step in correct manner. Also, initially there was some warning message related to sqlite3 in ubuntu terminal, hence in response to that I used "$ python manage.py migrate"
Code can be accessed at https://github.com/arunsingh/real_time_notification

Odoo/OpenERP "Unable to login on database odoo"

I am trying to install Odoo on a hosted machine. First, I created a new Postgres user "odoo" with database "odoo". Then, I cloned the GIT repositry "https://github.com/odoo/odoo". After that I ran:
./openerp-server -s -c server.cfg
This created a configuration file named "server.cfg". I edited the configuration by changing the database parameters. After that, I ran
./openerp-server -c server.cfg
This loaded all the necessary addons and the server started running.
Whenever I open the browser, I keep getting to the following url:
http://erp.example.com/web/database/selector?error=Unable%20to%20login%20on%20database%20odoo
I thought maybe this is a database error. So, I checked the database and all the tables are created in the database.
The database user and password created all the tables but for some reason I can't login to the database.
Has anyone had an issue like this? If yes, how did you fix it?
Maybe you don't set a password for your database yet, if it's the case: do it with this query :
ALTER USER odoo WITH ENCRYPTED PASSWORD '<type your password here>';
or : run odoo in the debug mode for see some details about the problem :
try this command
python openerp-server -r odoo -w '<the password>' --db_port=<5432 by default> --debug

Django syncdb error for blog tables

i'm following this tutorial: http://www.programmersbook.com/page/21/Django-Beginner-Tutorial-Part-I/
and I added the database details (running django.db.backends.postgresql_psycopg2) and i added the template dirs. But when i do
./manage.py syncdb
i get:
self.connection = Database.connect(**conn_params)
psycopg2.OperationalError: could not connect to server: Permission denied
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
Any suggestions on how i can fix this please?
Before connecting to database you need to install database server, and configure it for any user to access.
If you want just follow tutorial use SQLite -it's most simple to configure.
Otherwise, install database server of your choose, create database, configure access, make sure that connection details are correct, and/or DB server is up and running.
Best way is try to connect to server via command line.

Categories