Fix db initialization when running using gunicorn