Many online are python2, examples are sqlite, according to others said change Database_uri is unable to operate the MySQL database.
Under Python3 How to use Flask-sqlalchemy to MySQL database operation Ah, seemingly mysqldb does not support Python3
Ask the great God to answer the question ~
Reply content:
Well, it seems that the main problem has been solved, very good. I'm still going to give a little help to the novice who needs it later.
This question is often novice, because most of the tutorials (including the classic "Flask Web Development" book) tell us how to use Flask-sqlalchemy to manipulate SQLite, but in the production environment (online site), we must be using MySQL or other, And most of the tutorials tell us that the way Flask-sqlalchemy uses MySQL is:
mysql://username:password@server/db
Use Pymysql to connect to the database!! Python3 no use, because the Mac comes with or 2.7
You can use the following demo to run under the python2 you say:
Cfrs2005/flask_blog GitHub
Second, pay attention to installing MySQL, PIP installation Mysql-python related support class library