Dear all,
I got this error for a project that can be run normally locally:
Server Error (500)
For security reasons, the error message is not displayed here. You can view it with one of the below techniques:
Delete the OTREE_PRODUCTION environment variable and reload this page
Look at your Sentry messages (see the docs on how to enable Sentry)
Look at the server logs
The part of settings.py that I think is relevant:
#################
import os
from os import environ
import dj_database_url
import otree.settings
# to activate sentry
SENTRY_DSN = ...
# if you set a property in SESSION_CONFIG_DEFAULTS, it will be inherited by all configs
# in SESSION_CONFIGS, except those that explicitly override it.
# the session config can be accessed from methods in your apps as self.session.config,
# e.g. self.session.config['participation_fee']
SESSION_CONFIG_DEFAULTS = {
'real_world_currency_per_point': 1.00,
'participation_fee': 2.50,
'doc': "",
}
SESSION_CONFIGS = [
...
]
# see the end of this file for the inactive session configs
# ISO-639 code
# '''
# LANGUAGE_CODE = 'de' # for example: de, fr, ja, ko, zh-hans
# REAL_WORLD_CURRENCY_CODE = 'EUR' # e.g. EUR, GBP, CNY, JPY
# USE_POINTS = False
# '''
LANGUAGE_CODE = 'en'
REAL_WORLD_CURRENCY_CODE = 'GBP' # e.g. EUR, GBP, CNY, JPY
USE_POINTS = False
ROOM_DEFAULTS = {}
ROOMS = [
{
'name': 'Experiment',
'display_name': 'Experiment',
},
]
# for flexibility, you can set it in the environment variable OTREE_AUTH_LEVEL
AUTH_LEVEL = environ.get('OTREE_AUTH_LEVEL')
ADMIN_USERNAME = 'admin'
# for security, best to set admin password in an environment variable
ADMIN_PASSWORD = environ.get('OTREE_ADMIN_PASSWORD')
# Consider '', None, and '0' to be empty/false
DEBUG = (environ.get('OTREE_PRODUCTION') in {None, '', '0'})
...
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
# if an app is included in SESSION_CONFIGS, you don't need to list it here
INSTALLED_APPS = ['otree']
otree.settings.augment_settings(globals())
#######################################
When I change this line "DEBUG = (environ.get('OTREE_PRODUCTION') in {None, '', '0'})"
to: "DEBUG = (environ.get('OTREE_PRODUCTION') in {None, '', '1'})"
or "DEBUG = (environ.get('OTREE_PRODUCTION') in {'1'})"
or
if environ.get('OTREE_PRODUCTION') not in {None, '', '0'}:
DEBUG = False
else:
DEBUG = True
This is the error:
Request Method: GET
Django Version: 2.2.12
Exception Type: AssertionError
Exception Value:
database connection isn't set to UTC
Exception Location: /app/.heroku/python/lib/python3.7/site-packages/django/db/backends/postgresql/utils.py in utc_tzinfo_factory, line 6
Python Executable: /app/.heroku/python/bin/python
Python Version: 3.7.10
Python Path:
['/app/.heroku/python/bin',
'/app',
'/app/.heroku/python/lib/python37.zip',
'/app/.heroku/python/lib/python3.7',
'/app/.heroku/python/lib/python3.7/lib-dynload',
'/app/.heroku/python/lib/python3.7/site-packages']
Server time: Wed, 21 Jul 2021 16:11:33 +0200