SQLAlchemy database connection

Hello everybody concerned about my little partner, has not been updated for several days, has been reviewing too many hanging branches, small partners do not advise you hanging branches, more and more difficult to make up, and said he might as well say that they lazy busy , did not talk much, see the tutorial.

 

1. First of all we have Windows + R (Open Command Prompt), then the command directory to directory Flask virtual environment

2. Type pip install flask-sqlalchemy command to install flask-sqlalchemy plug.

3.windows search for computer services management to determine the SQL service is already up and running

4. Create a database named db_demo1 , type the command prompt string (port) in the command mysql-uroot--p , and enter their password before installing the mysql database when set, and then type the command create database db_demo1 charset utf8   create a test with the database.

5. Open pycharm software, a new basic construction, which in the main file import SQLAlchemy class and initialize an object server .

6. Create a configuration file config will write the configuration database on the inside.

 7. After we returned to the main file inside the test, create a database test function db.create_all ()

8. Finally compiled click on it, if a warning is normal, but the error is problematic 

 

If you like my blog, thumbs up trouble you to look at me the way, we will study together, share together, progress together.

I: QQ2992789432

 

发布了45 篇原创文章 · 获赞 96 · 访问量 1万+

Guess you like

Origin blog.csdn.net/qq_40831778/article/details/103139560