title: how to fix connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"? error when running bitbucket pipelines
body: <p>I am trying to run tests using bitbucket pipelines but unfortunately, I can not connect with postgresql.</p>
  
  <p>So I have tried adding <code>rm -rf /tmp/.s.PGSQL.5432/</code> to my bitbucket-pipeline.yml but nothing has changed when running my test</p>
  
  <p>This is the error that I get</p>
  
  <pre class="lang-sh prettyprint-override"><code>+ python manage.py test
  /usr/local/lib/python3.7/site-packages/django/db/backends/postgresql/base.py:265: RuntimeWarning: Normally Django will use a connection to the 'postgres' database to avoid running initialization queries against the production database when it's not needed (for example, when running tests). Django was unable to create a connection to the 'postgres' database and will use the first PostgreSQL database instead.
    RuntimeWarning
  nosetests --with-coverage --cover-package=accounts,rest_v1, property --verbosity=1
  Creating test database for alias 'default'...
  Traceback (most recent call last):
    File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 216, in ensure_connection
      self.connect()
    File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 194, in connect
      self.connection = self.get_new_connection(conn_params)
    File "/usr/local/lib/python3.7/site-packages/django/db/backends/postgresql/base.py", line 174, in get_new_connection
      connection = Database.connect(**conn_params)
    File "/usr/local/lib/python3.7/site-packages/psycopg2/__init__.py", line 130, in connect
      conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
  psycopg2.OperationalError: could not connect to server: No such file or directory
      Is the server running locally and accepting
      connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
  </code></pre>
  
  <p>bitbucket-pipelines.yml</p>
  
  <pre><code>image: python:3.6.2
  pipelines:
    default:
      - step:
          script:
            - pip install -r requirements.txt
            - python manage.py test
  
    branches:
      develop:
      - step:
          caches:
          - node
          script:
          - pip install -r requirements.txt
          - python manage.py test
  </code></pre>
  
  <p>setting.py</p>
  
  <pre class="lang-py prettyprint-override"><code>DATABASES = {
      'default': {
          'ENGINE': 'django.db.backends.postgresql',
          'NAME': 'db_name',
          'USER': 'user_name',
          'PASSWORD': 'db_password',
      }
  }
  </code></pre>
  
  <p>I expect bitbucket pipelines to run the test without issues especially DB connection issues</p>