AdventureLookup / adventurelookup-backend

Platform, Framework, Database software
GNU General Public License v3.0
28 stars 7 forks source link

Now able to access the admin page #10

Closed probably-not-a-cat closed 8 years ago

probably-not-a-cat commented 8 years ago

These are the changes I had to make to be able to access the admin page.

If there's something obviously wrong here, feel free to throw this away. I am unfamiliar with docker so these changes might not (probably) don't make sense.

pejter commented 8 years ago

I'm not sure what's the problem here. On the current master there is no problems with accessing the admin page. Could you describe the situation and provide some logs?

cpnielsen commented 8 years ago

FYI, using $DATA_DIR/postgresql = /var/lib/postgresql/ "works", but data is not persisted between machine takedowns (which defeats the purpose).

I will commit a fix for this (it only applies to OS X because of boot2docker issues) that will fix this for all development environments.

As for the admin page "fix" due to postgres password, that should not make any difference if you are using our setup as advertised. As @pejter says, can you provide some log output?

pejter commented 8 years ago

The data persistency is a known issue, as you say, I was referring to the "admin page issue". Sorry for confusion. Also you should never set an empty DB_PASS, because that changes postgres auth method from md5(user+pass) to ident(unix user)

probably-not-a-cat commented 8 years ago

I believe the error is due to docker-compose run web python initial_setup.py failing. Here's the output.

~/D/p/adventurelookup-backend (master) $ docker-compose run web python initial_setup.py
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/django/db/backends/base/base.py", line 199, in ensure_connection
    self.connect()
  File "/usr/local/lib/python3.5/site-packages/django/db/backends/base/base.py", line 171, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/usr/local/lib/python3.5/site-packages/django/db/backends/postgresql/base.py", line 175, in get_new_connection
    connection = Database.connect(**conn_params)
  File "/usr/local/lib/python3.5/site-packages/psycopg2/__init__.py", line 164, in connect
    conn = _connect(dsn, connection_factory=connection_factory, async=async)
psycopg2.OperationalError: could not connect to server: Connection refused
    Is the server running on host "postgres" (172.18.0.2) 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 "initial_setup.py", line 9, in <module>
    User.objects.create_superuser('admin', 'admin@adventurelookup.com', 'admin')
  File "/usr/local/lib/python3.5/site-packages/django/contrib/auth/models.py", line 165, in create_superuser
    return self._create_user(username, email, password, **extra_fields)
  File "/usr/local/lib/python3.5/site-packages/django/contrib/auth/models.py", line 148, in _create_user
    user.save(using=self._db)
  File "/usr/local/lib/python3.5/site-packages/django/contrib/auth/base_user.py", line 74, in save
    super(AbstractBaseUser, self).save(*args, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/django/db/models/base.py", line 708, in save
    force_update=force_update, update_fields=update_fields)
  File "/usr/local/lib/python3.5/site-packages/django/db/models/base.py", line 733, in save_base
    with transaction.atomic(using=using, savepoint=False):
  File "/usr/local/lib/python3.5/site-packages/django/db/transaction.py", line 158, in __enter__
    if not connection.get_autocommit():
  File "/usr/local/lib/python3.5/site-packages/django/db/backends/base/base.py", line 365, in get_autocommit
    self.ensure_connection()
  File "/usr/local/lib/python3.5/site-packages/django/db/backends/base/base.py", line 199, in ensure_connection
    self.connect()
  File "/usr/local/lib/python3.5/site-packages/django/db/utils.py", line 95, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/usr/local/lib/python3.5/site-packages/django/utils/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.5/site-packages/django/db/backends/base/base.py", line 199, in ensure_connection
    self.connect()
  File "/usr/local/lib/python3.5/site-packages/django/db/backends/base/base.py", line 171, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/usr/local/lib/python3.5/site-packages/django/db/backends/postgresql/base.py", line 175, in get_new_connection
    connection = Database.connect(**conn_params)
  File "/usr/local/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: could not connect to server: Connection refused
    Is the server running on host "postgres" (172.18.0.2) and accepting
    TCP/IP connections on port 5432?

This may be from the fact that I have rebuild docker a number of times.

pejter commented 8 years ago

Probably related to the data volume issue. Container might be rsetarting indefinitely, because it can't initialize. Also we should move this to an issue, I'm closing this PR. See #13