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
Solution.
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
URI
> I
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:
- How to Split numbers and strings in a strings
- Python: crawler handles strings of XML and HTML
- Android:More than one file was found with OS independent path ‘res/values/values.xml
- Python3-ValueError:not enough values to unpack (expected 2, got 0)
- The connection pool of SSM project database cannot be connected. The project can run normally and the database cannot be connected
- Solution to command line option syntax error. Type command /? For help
- Error: option –single-version-externally-managed not recognized when python pip installs third-party libraries
- After introducing sass into Vue project, start to report error typeerror [err]_ INVALID_ ARG_ Type]: the “path” argument must be of type string
- Python flash project to obtain the request user IP address addr
- Summary of solutions to open flash back problem after Python packaging
- Flash back problem of Python running
- SqlNullValueException: Data is Null. This method or property cannot be called on Null values.
- Python common error: if using all scalar values, you must pass an index (four solutions)
- python reads csv file is an error _csv.Error: iterator should return strings, not bytes (did you open the file in text)
- How to Solve mybatis returns null when querying Oracle database with char type field
- When Python Django creates a database, can’t open file ‘ manage.py ‘: [Errno 2] No such file or directory
- Error occurred when Python called cv2.findcontours: valueerror: not enough values to unpack (expected 3, got 2)
- Type error: the JSON object must be STR, bytes or byte array, not ‘textiowrapper’
- mysql workbench Error Code: 1046. No database selected Select the default DB to be used
- 1716438 – Error :” Failed to load database information Details: The Database connector crdb_bwquery.