0

I've already download all packages from django, whitenoise, etc, and the error continues.
The cmd is running with the env and triyng to push i'm still on the same error

I'm trying to run with a local host my server and that happend :

Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
Exception in thread django-main-thread:
Traceback (most recent call last):
  File "C:\Users\Domestico\Documents\GitHub\venv\lib\site-packages\django\utils\asyncio.py", line 26, in inner
    return func(*args, **kwargs)
  File "C:\Users\Domestico\Documents\GitHub\venv\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 "C:\Users\Domestico\anaconda3\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\Domestico\Documents\GitHub\venv\lib\site-packages\django\core\management\commands\runserver.py", line 121, in inner_run
    self.check_migrations()
  File "C:\Users\Domestico\Documents\GitHub\venv\lib\site-packages\django\db\migrations\executor.py", line 18, in __init__
    self.loader = MigrationLoader(self.connection)
  File "C:\Users\Domestico\Documents\GitHub\venv\lib\site-packages\django\db\migrations\recorder.py", line 55, in has_table
    with self.connection.cursor() as cursor:
  File "C:\Users\Domestico\Documents\GitHub\venv\lib\site-packages\django\db\utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "C:\Users\Domestico\Documents\GitHub\venv\lib\site-packages\django\utils\asyncio.py", line 26, in inner
    return func(*args, **kwargs)
  File "C:\Users\Domestico\Documents\GitHub\venv\lib\site-packages\django\db\backends\base\base.py", line 200, in connect
    self.connection = self.get_new_connection(conn_params)
  File "C:\Users\Domestico\Documents\GitHub\venv\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?```
Chuck.h5
  • 1
  • 3

1 Answers1

0

Can you give us a few more details, like what command are you running to start your server, are you trying to see the webpage from the same computer or are you trying to connect to it remotely?

Have you tried running the server using this python manage.py runserver and then trying to connect to it?

Is there any reason you are using port 5432 as the default is 8000 so it may be best to get that working first before changing the port.

  • Yep, i forget to put in the code but thats what i put in cmd to run it. and then i got that error. And door 5432 – Chuck.h5 Feb 10 '21 at 23:05
  • Can you check you do not already have an instance of PostgreSQL already running before you try to start the server? Can you try running this command {pg_ctl -D "C:\Program Files\PostgreSQL\9.6\data" stop} before you try and run the Django server. Make sure you change the file location to where your PostgreSQL install is located. – ProgramMasher Feb 12 '21 at 13:18