Changes the default charset for MySQL (#282)

This bug is actually quite sneaky and was breaking exports
selenium-screenshot-testing
Kevin Chung 2017-06-16 15:32:09 -04:00 committed by GitHub
parent e732e90661
commit 34237e6292
1 changed files with 5 additions and 1 deletions

View File

@ -43,7 +43,11 @@ def create_app(config='CTFd.config.Config'):
# Creates database if the database database does not exist
if not database_exists(url):
create_database(url)
if url.drivername.startswith('mysql'):
url.query['charset'] = 'utf8mb4'
create_database(url, encoding='utf8mb4')
else:
create_database(url)
# Register database
db.init_app(app)