python - django postgres could not connect to server -
hi im working on django project virtualenv using following django==1.7.6 argparse==1.2.1 psycopg2==2.6 wsgiref==0.1.2
but when try python manage.py runserver
gives me error
performing system checks... system check identified no issues (0 silenced). unhandled exception in thread started <function wrapper @ 0x7f0574e8c0c8> traceback (most recent call last): file "/home/marashen/.virtualenvs/192/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 222, in wrapper fn(*args, **kwargs) file "/home/marashen/.virtualenvs/192/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 107, in inner_run self.check_migrations() file "/home/marashen/.virtualenvs/192/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 159, in check_migrations executor = migrationexecutor(connections[default_db_alias]) file "/home/marashen/.virtualenvs/192/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 17, in __init__ self.loader = migrationloader(self.connection) file "/home/marashen/.virtualenvs/192/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 48, in __init__ self.build_graph() file "/home/marashen/.virtualenvs/192/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 183, in build_graph self.applied_migrations = recorder.applied_migrations() file "/home/marashen/.virtualenvs/192/local/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 59, in applied_migrations self.ensure_schema() file "/home/marashen/.virtualenvs/192/local/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 49, in ensure_schema if self.migration._meta.db_table in self.connection.introspection.get_table_list(self.connection.cursor()): file "/home/marashen/.virtualenvs/192/local/lib/python2.7/site-packages/django/db/backends/__init__.py", line 165, in cursor cursor = self.make_debug_cursor(self._cursor()) file "/home/marashen/.virtualenvs/192/local/lib/python2.7/site-packages/django/db/backends/__init__.py", line 138, in _cursor self.ensure_connection() file "/home/marashen/.virtualenvs/192/local/lib/python2.7/site-packages/django/db/backends/__init__.py", line 133, in ensure_connection self.connect() file "/home/marashen/.virtualenvs/192/local/lib/python2.7/site-packages/django/db/utils.py", line 94, in __exit__ six.reraise(dj_exc_type, dj_exc_value, traceback) file "/home/marashen/.virtualenvs/192/local/lib/python2.7/site-packages/django/db/backends/__init__.py", line 133, in ensure_connection self.connect() file "/home/marashen/.virtualenvs/192/local/lib/python2.7/site-packages/django/db/backends/__init__.py", line 122, in connect self.connection = self.get_new_connection(conn_params) file "/home/marashen/.virtualenvs/192/local/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 130, in get_new_connection connection = database.connect(**conn_params) file "/home/marashen/.virtualenvs/192/local/lib/python2.7/site-packages/psycopg2/__init__.py", line 164, in connect conn = _connect(dsn, connection_factory=connection_factory, async=async) django.db.utils.operationalerror: not connect server: connection refused is server running on host "127.0.0.1" , accepting tcp/ip connections on port 5432?
my settings.py
databases = { 'default': { 'engine': 'django.db.backends.postgresql_psycopg2', 'name': 'elfmsdb', 'user': 'postgres', 'password': '', 'host': '127.0.0.1', 'port': '5432', } }
i checked postgresql.conf , using 5432 port.
another odd thing accidentally runserver outside virtualenv , worked django version 1.6.
please me, lot!
i dont know problem tried
$sudo service postgresql restart , runserver worked after that.
Comments
Post a Comment