title: django.db.utils.OperationalError: FATAL: Peer authentication failed for user "deadlylaid"
body: <p>I develop my project in macOS</p>
  
  <p>and I want product my project in ubuntu(AWS)</p>
  
  <p>(im sorry about my low level english) </p>
  
  <p>$ git clone "myproject " (in ubuntu/AWS) ,
  and i did so many settings(=MacOs)</p>
  
  <p>pip freeze(in ubuntu)</p>
  
  <pre><code>boto==2.39.0
  decorator==4.0.9
  defusedxml==0.4.1
  Django==1.9.4
  django-debug-toolbar==1.4
  django-extensions==1.6.1
  django-multiupload==0.5
  django-pipeline==1.6.8
  django-storages-redux==1.3.2
  djangorestframework==3.3.3
  hashids==1.1.0
  ipython==4.1.2
  ipython-genutils==0.1.0
  oauthlib==1.0.3
  pep8==1.7.0
  pexpect==4.0.1
  pickleshare==0.7.2
  Pillow==3.2.0
  psycopg2==2.6.1
  ptyprocess==0.5.1
  PyJWT==1.4.0
  python3-openid==3.0.10
  requests==2.9.1
  requests-oauthlib==0.6.1
  simplegeneric==0.8.1
  six==1.10.0
  sqlparse==0.1.19
  traitlets==4.2.1
  </code></pre>
  
  <p>pip freeze(my MacOs)</p>
  
  <pre><code>appnope==0.1.0
  boto==2.39.0
  decorator==4.0.9
  defusedxml==0.4.1
  Django==1.9.4
  django-debug-toolbar==1.4
  django-extensions==1.6.1
  django-multiupload==0.5
  django-pipeline==1.6.8
  django-storages-redux==1.3.2
  djangorestframework==3.3.3
  gnureadline==6.3.3
  hashids==1.1.0
  ipython==4.1.2
  ipython-genutils==0.1.0
  oauthlib==1.0.3
  path.py==8.1.2
  pep8==1.7.0
  pexpect==4.0.1
  pickleshare==0.6
  Pillow==3.2.0
  psycopg2==2.6.1
  ptyprocess==0.5.1
  PyJWT==1.4.0
  python3-openid==3.0.10
  requests==2.9.1
  requests-oauthlib==0.6.1
  simplegeneric==0.8.1
  six==1.10.0
  sqlparse==0.1.19
  traitlets==4.2.1
  </code></pre>
  
  <p>pwd(in ubuntu)</p>
  
  <pre><code>(amulldanji) ubuntu@ip-172-31-17-137:~/amulldanji/amulldanji$ pwd
  /home/ubuntu/amulldanji/amulldanji
  </code></pre>
  
  <p>pwd(in MacOs)</p>
  
  <pre><code>(amulldanji) ☁  amulldanji [feature/init] ⚡ pwd
  /Users/hanminsoo/Documents/amulldanji/amulldanji
  </code></pre>
  
  <p>cat .env(in MacOs)</p>
  
  <pre><code>pyenv activate amulldanji
  
  echo "##################"
  echo "애물단지 프로잭트"
  echo "##################"
  
  alias ma="python amulldanji/manage.py"
  alias mr="python amulldanji/manage.py runserver"
  
  # 기본 runserver 값은 development로 설정
  export DJANGO_SETTINGS_MODULE="amulldanji.settings.development"
  
  # AWS S3및 Cloud front에 접근하기 위한 키
  export AWS_ACCESS_KEY_ID="AK-----------------"
  export AWS_ACCESS_SECRET_KEY="1--------------------------"
  export AWS_BUCKET_NAME="amulldanji"
  
  # postgesql을 사용하기 위한 설정(database.py에서 이용됨)
  export DATABASE_NAME="amulldanji"
  export DATABASE_USER="deadlylaid"
  export DATABASE_PASSWORD="deadlylaid"
  </code></pre>
  
  <p>cat .env(in ubuntu)</p>
  
  <pre><code>pyenv activate amulldanji
  echo "###############"
  echo "amulldanji 배포"
  echo "###############"
  
  alias ma="python amulldanji/manage.py"
  alias mr="python amulldanji/manage.py runserver"
  
  export DJANGO_SETTINGS_MODULE="amullanji.settings.development"
  
  export AWS_ACCESS_KEY_ID="AK-------------"
  export AWS_ACCESS_SECRET_KEY="1--------------------"
  export AWS_BUCKET_NAME="amulldanji"
  
  export DATABASE_NAME="amulldanji"
  export DATABASE_USER="deadlylaid"
  export DATABASE_PASSWORD="deadlylaid"
  </code></pre>
  
  <p>pip -V(in MacOs)</p>
  
  <pre><code>pip 7.1.2 from /Users/hanminsoo/.pyenv/versions/3.5.1/envs/amulldanji/lib/python3.5/site-packages (python 3.5)
  </code></pre>
  
  <p>pip -V(in ubuntu)</p>
  
  <pre><code>pip 7.1.2 from /home/ubuntu/.pyenv/versions/3.5.1/envs/amulldanji/lib/python3.5/site-packages (python 3.5)
  </code></pre>
  
  <p>psql(in MacOs)</p>
  
  <pre><code>psql (9.5.1)
  Type "help" for help.
  
  hanminsoo=# \l
                                  List of databases
      Name    |   Owner   | Encoding |   Collate   |    Ctype    |    Access privileges
  ------------+-----------+----------+-------------+-------------+--------------------------
   amulldanji | hanminsoo | UTF8     | ko_KR.UTF-8 | ko_KR.UTF-8 | =Tc/hanminsoo           +
              |           |          |             |             | hanminsoo=CTc/hanminsoo +
              |           |          |             |             | deadlylaid=CTc/hanminsoo
   hanminsoo  | hanminsoo | UTF8     | ko_KR.UTF-8 | ko_KR.UTF-8 |
   postgres   | hanminsoo | UTF8     | ko_KR.UTF-8 | ko_KR.UTF-8 |
   template0  | hanminsoo | UTF8     | ko_KR.UTF-8 | ko_KR.UTF-8 | =c/hanminsoo            +
              |           |          |             |             | hanminsoo=CTc/hanminsoo
   template1  | hanminsoo | UTF8     | ko_KR.UTF-8 | ko_KR.UTF-8 | =c/hanminsoo            +
              |           |          |             |             | hanminsoo=CTc/hanminsoo
  </code></pre>
  
  <p>sudo -u postgres psql(in ubuntu)</p>
  
  <pre><code>postgres-# \l
                                 List of databases
      Name    |  Owner   | Encoding |   Collate   |    Ctype    |    Access privileges
  ------------+----------+----------+-------------+-------------+-------------------------
   amulldanji | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres           +
              |          |          |             |             | postgres=CTc/postgres  +
              |          |          |             |             | deadlylaid=CTc/postgres
   postgres   | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
   template0  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres            +
              |          |          |             |             | postgres=CTc/postgres
   template1  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres            +
              |          |          |             |             | postgres=CTc/postgres
  </code></pre>
  
  <p>amulldanji/settings/batabase.py</p>
  
  <pre><code>import os
  
  from .base import BASE_DIR
  
  # Database
  # https://docs.djangoproject.com/en/1.9/ref/settings/#databases
  
  DATABASES = {
      'default': {
          'ENGINE': 'django.db.backends.postgresql_psycopg2',
          'NAME': os.environ.get("DATABASE_NAME"),
          'USER': os.environ.get("DATABASE_USER"),
          'PASSWORD': os.environ.get("DATABASE_PASSWORD"),
      }
  }
  </code></pre>
  
  <p>python amulldanji/manage.py makemigrations and migrate(in ubuntu)</p>
  
  <pre><code>python amulldanji/manage.py makemigrations users items
  No changes detected in apps 'items', 'users'
  python amulldanji/manage.py migrate
  Traceback (most recent call last):
    File "/home/ubuntu/.pyenv/versions/amulldanji/lib/python3.5/site-packages/django/db/backends/base/base.py", line 199, in ensure_connection
  self.connect()
    File "/home/ubuntu/.pyenv/versions/amulldanji/lib/python3.5/site-packages/django/db/backends/base/base.py", line 171, in connect
  self.connection = self.get_new_connection(conn_params)
    File "/home/ubuntu/.pyenv/versions/amulldanji/lib/python3.5/site-packages/django/db/backends/postgresql/base.py", line 175, in get_new_connection
  connection = Database.connect(**conn_params)
    File "/home/ubuntu/.pyenv/versions/amulldanji/lib/python3.5/site-packages/psycopg2/__init__.py", line 164, in connect
  conn = _connect(dsn, connection_factory=connection_factory, async=async)
  psycopg2.OperationalError: FATAL:  Peer authentication failed for user "deadlylaid"
  
  
  The above exception was the direct cause of the following exception:
  
  Traceback (most recent call last):
    File "amulldanji/manage.py", line 10, in &lt;module&gt;
  execute_from_command_line(sys.argv)
    File "/home/ubuntu/.pyenv/versions/amulldanji/lib/python3.5/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
  utility.execute()
    File "/home/ubuntu/.pyenv/versions/amulldanji/lib/python3.5/site-packages/django/core/management/__init__.py", line 345, in execute
  self.fetch_command(subcommand).run_from_argv(self.argv)
    File "/home/ubuntu/.pyenv/versions/amulldanji/lib/python3.5/site-packages/django/core/management/base.py", line 348, in run_from_argv
  self.execute(*args, **cmd_options)
    File "/home/ubuntu/.pyenv/versions/amulldanji/lib/python3.5/site-packages/django/core/management/base.py", line 399, in execute
  output = self.handle(*args, **options)
    File "/home/ubuntu/.pyenv/versions/amulldanji/lib/python3.5/site-packages/django/core/management/commands/migrate.py", line 89, in handle
  executor = MigrationExecutor(connection, self.migration_progress_callback)
    File "/home/ubuntu/.pyenv/versions/amulldanji/lib/python3.5/site-packages/django/db/migrations/executor.py", line 20, in __init__
  self.loader = MigrationLoader(self.connection)
    File "/home/ubuntu/.pyenv/versions/amulldanji/lib/python3.5/site-packages/django/db/migrations/loader.py", line 49, in __init__
  self.build_graph()
    File "/home/ubuntu/.pyenv/versions/amulldanji/lib/python3.5/site-packages/django/db/migrations/loader.py", line 176, in build_graph
  self.applied_migrations = recorder.applied_migrations()
    File "/home/ubuntu/.pyenv/versions/amulldanji/lib/python3.5/site-packages/django/db/migrations/recorder.py", line 65, in applied_migrations
  self.ensure_schema()
    File "/home/ubuntu/.pyenv/versions/amulldanji/lib/python3.5/site-packages/django/db/migrations/recorder.py", line 52, in ensure_schema
  if self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor()):
    File "/home/ubuntu/.pyenv/versions/amulldanji/lib/python3.5/site-packages/django/db/backends/base/base.py", line 231, in cursor
  cursor = self.make_debug_cursor(self._cursor())
    File "/home/ubuntu/.pyenv/versions/amulldanji/lib/python3.5/site-packages/django/db/backends/base/base.py", line 204, in _cursor
  self.ensure_connection()
    File "/home/ubuntu/.pyenv/versions/amulldanji/lib/python3.5/site-packages/django/db/backends/base/base.py", line 199, in ensure_connection
  self.connect()
    File "/home/ubuntu/.pyenv/versions/amulldanji/lib/python3.5/site-packages/django/db/utils.py", line 95, in __exit__
  six.reraise(dj_exc_type, dj_exc_value, traceback)
    File "/home/ubuntu/.pyenv/versions/amulldanji/lib/python3.5/site-packages/django/utils/six.py", line 685, in reraise
  raise value.with_traceback(tb)
    File "/home/ubuntu/.pyenv/versions/amulldanji/lib/python3.5/site-packages/django/db/backends/base/base.py", line 199, in ensure_connection
  self.connect()
    File "/home/ubuntu/.pyenv/versions/amulldanji/lib/python3.5/site-packages/django/db/backends/base/base.py", line 171, in connect
  self.connection = self.get_new_connection(conn_params)
    File "/home/ubuntu/.pyenv/versions/amulldanji/lib/python3.5/site-packages/django/db/backends/postgresql/base.py", line 175, in get_new_connection
  connection = Database.connect(**conn_params)
    File "/home/ubuntu/.pyenv/versions/amulldanji/lib/python3.5/site-packages/psycopg2/__init__.py", line 164, in connect
  conn = _connect(dsn, connection_factory=connection_factory, async=async)
  django.db.utils.OperationalError: FATAL:  Peer authentication failed for user "deadlylaid"
  
  make: *** [migrate] Error 1
  </code></pre>
  
  <p>i search so much imformation.. and so many solutions but they can't solved my problem</p>
  
  <p>please someone help me...</p>