Python-web framework-Use SQLAlchemy to create a connection to the database MySQL, in detail with the flask will encounter some big pits!

Source: Internet
Author: User

After this small project is a new understanding of the two Web frameworks Django and flask, Django itself has a very complete set of wheels, routines are also fixed, novice in contact with the Django framework, will not be caught in the big hole looking for wheels everywhere;

So in the use of flask this framework will encounter what big pits, first flask is a lightweight web framework, the reason is that it is lightweight because it does not have many wheels, it is not necessary to represent these wheels need our own to build it, that is not necessary, but we need to find these wheels, it is precisely is to exercise your mind, you have to find the wheel before you need to know which wheels, what the role of these wheels, know these, after the next step;

The point is, what does the wheel mean here, and why is it a pit, flask? The documentation and data for this framework are far from as rich and clear as Django, and you may be able to find some information on the web that appears to be what you need, but it is very likely that the modules used, the drivers will have different versions of the pits , from the wheel of patchwork to get together may appear a variety of error, this time you have an error to resolve the error, to check the cause of the error, to check the Patchwork module documentation, there are many versions of the MySQL driver, Pymysql, MYSQLDB, MySQL -connector, Mysql-connector-python, if you choose MySQLdb, then congratulate you this is python2.x version, if you choose Mysql-connector-python, then congratulate you, This only support to python3.4 haha, if the choice of Pymysql, although the program can run, but there will be a variety of warnings such as the long string of red font, looked very annoying, after the actual selection of Mysql-connector will not have any problems;

In addition, there are some use of database additions and deletions to the pit, database statements are not as clean as the Python statement, some statements at the end to add a semicolon, some at the end do not need to add, and sometimes even have the singular and plural object of the difference, a little attention to your statement there is no effect or error.

Finally directly on the source and some notes it ...

Python-web framework-Use SQLAlchemy to create a connection to the database MySQL, in detail with the flask will encounter some big pits!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.