I'm trying to connect my Otree project to MySQL database, but whatever I do it doesn't replace the default database (which is SQLite) with MySQL. When I run the command otree runprodserver 80
and try to access localhost:80
I get the following message:
Your database is not ready. Try running 'otree resetdb'. (Missing tables for otree.FailedSessionCreation, otree.ChatMessage, sessions.Session, and 15 other models).
(obviously running 'otree resetdb' does not solve the problem.)
I added the following lines to settings.py
:
environ['DATABASE_URL'] = 'mysql://localhost:3306'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'DBNAME',
'USER': 'DBUSER',
'PASSWORD': 'DBPASSWORD',
'HOST': 'localhost',
'PORT': '3306',
}
}
but it still doesn't work. Any ideas what can I do to solve the problem? Thanks.