#1
by
Felicity
(edited )
Hi everyone,
I am currently facing a problem deploying my project on Heroku server on oTree Hub when I click on Reset DB. I did not face any issues deploying this same project until about 12 hours ago. I have made no changes to my code since then. It has also been working smoothly on the Demo server. But I did add Rooms and Session_Configs in my settings.py file. Can someone please help me resolve this?
Here is the Reset DB error:
Resetdb failed.
Starting process with command `otree resetdb --noinput`
State changed from starting to up
Traceback (most recent call last):
File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2336, in _wrap_pool_connect
return fn()
File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 364, in connect
return _ConnectionFairy._checkout(self)
File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 778, in _checkout
fairy = _ConnectionRecord.checkout(pool)
File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 495, in checkout
rec = pool._do_get()
File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/pool/impl.py", line 424, in _do_get
return self.connection
File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py", line 893, in __get__
obj.__dict__[self.__name__] = result = self.fget(obj)
File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/pool/impl.py", line 393, in connection
return _ConnectionRecord(self)
File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 440, in __init__
self.__connect(first_connect_check=True)
File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 661, in __connect
pool.logger.debug("Error on connect(): %s", e)
File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py", line 68, in __exit__
compat.raise_(
File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
raise exception
File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 656, in __connect
connection = pool._invoke_creator(self)
File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/engine/strategies.py", line 114, in connect
return dialect.connect(*cargs, **cparams)
File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 509, in connect
return self.dbapi.connect(*cargs, **cparams)
File "/app/.heroku/python/lib/python3.9/site-packages/psycopg2/__init__.py", line 122, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: connection to server at "ec2-3-232-218-211.compute-1.amazonaws.com" (3.232.218.211), port 5432 failed: FATAL: password authentication failed for user "atwngdsibdlqtz"
connection to server at "ec2-3-232-218-211.compute-1.amazonaws.com" (3.232.218.211), port 5432 failed: FATAL: no pg_hba.conf entry for host "3.235.42.231", user "atwngdsibdlqtz", database "d7cmth0g0rg6pb", no encryption
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/app/.heroku/python/bin/otree", line 8, in
sys.exit(execute_from_command_line())
File "/app/.heroku/python/lib/python3.9/site-packages/otree/main.py", line 108, in execute_from_command_line
setup()
File "/app/.heroku/python/lib/python3.9/site-packages/otree/main.py", line 139, in setup
init_orm()
File "/app/.heroku/python/lib/python3.9/site-packages/otree/database.py", line 324, in init_orm
AnyModel.metadata.create_all(engine)
File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/sql/schema.py", line 4553, in create_all
bind._run_visitor(
File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2094, in _run_visitor
with self._optional_conn_ctx_manager(connection) as conn:
File "/app/.heroku/python/lib/python3.9/contextlib.py", line 119, in __enter__
return next(self.gen)
File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2086, in _optional_conn_ctx_manager
with self._contextual_connect() as conn:
File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2302, in _contextual_connect
self._wrap_pool_connect(self.pool.connect, None),
File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2339, in _wrap_pool_connect
Connection._handle_dbapi_exception_noconnection(
File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1583, in _handle_dbapi_exception_noconnection
util.raise_(
File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
raise exception
File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2336, in _wrap_pool_connect
return fn()
File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 364, in connect
return _ConnectionFairy._checkout(self)
File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 778, in _checkout
fairy = _ConnectionRecord.checkout(pool)
File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 495, in checkout
rec = pool._do_get()
File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/pool/impl.py", line 424, in _do_get
return self.connection
File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py", line 893, in __get__
obj.__dict__[self.__name__] = result = self.fget(obj)
File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/pool/impl.py", line 393, in connection
return _ConnectionRecord(self)
File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 440, in __init__
self.__connect(first_connect_check=True)
File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 661, in __connect
pool.logger.debug("Error on connect(): %s", e)
File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py", line 68, in __exit__
compat.raise_(
File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
raise exception
File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 656, in __connect
connection = pool._invoke_creator(self)
File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/engine/strategies.py", line 114, in connect
return dialect.connect(*cargs, **cparams)
File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 509, in connect
return self.dbapi.connect(*cargs, **cparams)
File "/app/.heroku/python/lib/python3.9/site-packages/psycopg2/__init__.py", line 122, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) connection to server at "ec2-3-232-218-211.compute-1.amazonaws.com" (3.232.218.211), port 5432 failed: FATAL: password authentication failed for user "atwngdsibdlqtz"
connection to server at "ec2-3-232-218-211.compute-1.amazonaws.com" (3.232.218.211), port 5432 failed: FATAL: no pg_hba.conf entry for host "3.235.42.231", user "atwngdsibdlqtz", database "d7cmth0g0rg6pb", no encryption
(Background on this error at: http://sqlalche.me/e/13/e3q8)
Sentry is attempting to send 2 pending events
Waiting up to 2 seconds
Press Ctrl-C to quit
Process exited with status 1
State changed from up to complete
Best,
Sonal
#2
by
Felicity
(edited )
Shown below is my requirements.txt file. I have not made any changes to this. All installation requirements are already satisfied when I use pip install -r requirements.txt # oTree-may-overwrite-this-file # IF YOU MODIFY THIS FILE, remove these comments. # otherwise, oTree will automatically overwrite it. otree==5.10.3 psycopg2>=2.8.4 sentry-sdk>=0.7.9
#3
by
Chris_oTree
For some reason it seems your DATABASE_URL config var is not correct. It should be set automatically. Did you manually edit it (via the heroku dashboard 'config vars' section), or override it in settings.py?
#4
by
Felicity
Hi Chris, Thanks for the reply. Yes, that was the issue! I clicked on "Reveal Config Vars" on my Heroku dashboard and made sure to match all "Config Vars" fields with corresponding fields of my settings.py file in the oTree project. That solved the problem.
#5
by
Chris_oTree
They shouldn’t be duplicated.a property should either be a config var or a settings.py setting, not both
#6
by
Chris_oTree
You may need to delete some stuff from your settings.py. See the examples in the official demo apps of what it should look like