0

I am not sure how to fix this issue I have no idea why I am getting this error when I try to python manage.py makemigrations Error:

(myproject) D:\E\Project\Trials\Book inventory Assignment>python manage.py makemigrations
Traceback (most recent call last):
  File "C:\Users\Krishna Veer Singh\Envs\myproject\lib\site-packages\django\db\backends\base\base.py", line 217, in ensure_connection
    self.connect()
  File "C:\Users\Krishna Veer Singh\Envs\myproject\lib\site-packages\django\db\backends\base\base.py", line 195, in connect
    self.connection = self.get_new_connection(conn_params)
  File "C:\Users\Krishna Veer Singh\Envs\myproject\lib\site-packages\django\db\backends\postgresql\base.py", line 178, in get_new_connection
    connection = Database.connect(**conn_params)
  File "C:\Users\Krishna Veer Singh\Envs\myproject\lib\site-packages\psycopg2\__init__.py", line 127, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: could not connect to server: Connection refused (0x0000274D/10061)
        Is the server running on host "127.0.0.1" and accepting
        TCP/IP connections on port 5432?

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 21, in <module>
    main()
  File "manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "C:\Users\Krishna Veer Singh\Envs\myproject\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "C:\Users\Krishna Veer Singh\Envs\myproject\lib\site-packages\django\core\management\__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Users\Krishna Veer Singh\Envs\myproject\lib\site-packages\django\core\management\base.py", line 323, in run_from_argvThe above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 21, in <module>
    main()
  File "manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "C:\Users\Krishna Veer Singh\Envs\myproject\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "C:\Users\Krishna Veer Singh\Envs\myproject\lib\site-packages\django\core\management\__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Users\Krishna Veer Singh\Envs\myproject\lib\site-packages\django\core\management\base.py", line 323, in run_from_argv
File "C:\Users\Krishna Veer Singh\Envs\myproject\lib\site-packages\django\db\backends\base\base.py", line 233, in _cursor
    self.ensure_connection()
  File "C:\Users\Krishna Veer Singh\Envs\myproject\lib\site-packages\django\db\backends\base\base.py", line 217, in ensure_connection
    self.connect()
  File "C:\Users\Krishna Veer Singh\Envs\myproject\lib\site-packages\django\db\utils.py", line 89, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "C:\Users\Krishna Veer Singh\Envs\myproject\lib\site-packages\django\db\backends\base\base.py", line 217, in ensure_connection
    self.connect()
  File "C:\Users\Krishna Veer Singh\Envs\myproject\lib\site-packages\django\db\backends\base\base.py", line 195, in connect
    self.connection = self.get_new_connection(conn_params)
  File "C:\Users\Krishna Veer Singh\Envs\myproject\lib\site-packages\django\db\backends\postgresql\base.py", line 178, in get_new_connection
    connection = Database.connect(**conn_params)
  File "C:\Users\Krishna Veer Singh\Envs\myproject\lib\site-packages\psycopg2\__init__.py", line 127, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: could not connect to server: Connection refused (0x0000274D/10061)
        Is the server running on host "127.0.0.1" and accepting
        TCP/IP connections on port 5432?

settings.py:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'inventory_database',
        'USER': 'manikaran',
        'PASSWORD': 'Aossie',
        'HOST': '127.0.0.1',
        'PORT': '5432',
    }
}
krishna veer
  • 474
  • 1
  • 4
  • 16

0 Answers0