[solution] Python flash database migrate error type error: option values must be strings

Problem situation:

After the database has been configured in the Python Flask project and the model class has been defined, execute the command.
# Note: The db in the command is the name of one of the commands for the database defined in the configuration
$ python manage.py db init
$ python manage.py db migrate -m "initial"
Execute to migrate, followed by an error reporting.

File “C:\Python36\lib\configparser.py”, line 1177, in _validate_value_types raise TypeError(“option values must be strings”)
TypeError: <flask_script.commands.Command object at 0x000000F01214E6D8>: option values must be strings

Check the configuration file of the database.

 # Configuration information for the database
    SQLALCHEMY_DATABASE_URL = "mysql://root:[email protected]:3306/databasename"

Note: Here’s sqllchemy_ DATABASE_ URL , correct writing: Sqlalchemy_ DATABASE_ URI

Please change the name of the configuration.

you can also read the contents of stckoverflow: https://stackoverflow.com/questions/49472259/python-manage-py-db-migrate-makesoption-values-must-be-strings-in-flask-mi

Read More: