Flask Framework Learning Notes (API Interface management platform V2.0)

Source: Internet
Author: User

Bloggers today posted API Interface management platform to GitHub, this time to update some of the features

such as support for local database sqlite3, optimized data structure

The technical aspect is the same as the previous V1.0, only increasing the production of local data, but in order to support the level of parameters, modified data structure, the following is the new model.py

1 #!/usr/bin/env python2 #-*-coding:utf-8-*-3 4  fromAppImportDB5 6 7 classUser (db. Model):8USER_ID = db. Column (db. Integer, Primary_key=true, autoincrement=True)9USER_NAME = db. Column (db. String (64))TenPassword = db. Column (db. String (64)) OneStatus =db. Column (db. Integer) ALevel =db. Column (db. Integer) -  -  the classModel (db. Model): -model_id = db. Column (db. Integer, Primary_key=true, autoincrement=True) -Model_name = db. Column (db. String (256)) -Status =db. Column (db. Integer) +     #Item Category ID, name, status -  +  A classInterface (db. Model): atinterface_id = db. Column (db. Integer, Primary_key=true, autoincrement=True) -model_id = db. Column (db. Integer, Db. ForeignKey ("model.model_id")) -Interface_name = db. Column (db. String (64)) -Interface_url = db. Column (db. String (1024)) -Interface_method = db. Column (db. String (64)) -Request_exam = db. Column (db. String (4096)) inResponse_exam = db. Column (db. String (4096)) -Status =db. Column (db. Integer) to     #Interface Information +      -  the classParameter (db. Model): *parameter_id = db. Column (db. Integer, Primary_key=true, autoincrement=True) $interface_id = db. Column (db. Integer, Db. ForeignKey ("interface.interface_id"))Panax NotoginsengParameter_type = db. Column (db. String (64)) -parameter_group_id =db. Column (db. Integer) theParameter_name = db. Column (db. String (64)) +necessary = db. Column (db. String (64)) AType = db. Column (db. String (64)) theDefault = db. Column (db. String (64)) +Remark = db. Column (db. String (64)) -Level = db. Column (db. String (64)) $     #parameter Information

Then the form fields are redefined according to the defined structure forms.py

1 #!/usr/bin/env python2 #-*-coding:utf-8-*-3 4  fromFlask_wtfImportForm5  fromWtformsImportStringfield, TextField, Passwordfield, FormField, Submitfield, FieldList, Integerfield6  fromWtforms.validatorsImportRequired, datarequired7 8 9 classLoginForm (Form):TenUsername = Stringfield ("Login Name", validators=[Required ()]) OnePassword = Passwordfield ("Password", validators=[Required ()]) A  -  - classModelform (Form): theModel_name = Stringfield ("Chinese name", validators=[Required ()]) -  -  - classInterfaceform (Form): +Interface_name = Stringfield ("Interface Name", validators=[Required ()]) -Interface_url = Stringfield ("Interface Address", validators=[Required ()]) +Interface_method = Stringfield ("interface Method", validators=[Required ()]) ARequest_exam = TextField ("Request Example", validators=[Required ()]) atResponse_exam = TextField ("Return Example", validators=[Required ()]) -  -  - classParameterrequestform (Form): -parameter_group_id = Stringfield ("subordinate", validators=[Required ()]) -Parameter_name = Stringfield ("Parameter name", validators=[Required ()]) innecessary = Stringfield ("whether you must", validators=[Required ()]) -Type = Stringfield ("type", validators=[Required ()]) toDefault = Stringfield ("Default Value", validators=[Required ()]) +Remark = Stringfield ("Notes", validators=[Required ()]) -Level = Stringfield ("level", validators=[Required ()]) the  *  $ classParameterresponseform (Form):Panax Notoginsengparameter_group_id = Stringfield ("subordinate", validators=[Required ()]) -Parameter_name = Stringfield ("Parameter name", validators=[Required ()]) thenecessary = Stringfield ("whether you must", validators=[Required ()]) +Type = Stringfield ("type", validators=[Required ()]) ADefault = Stringfield ("Example", validators=[Required ()]) theRemark = Stringfield ("Description", validators=[Required ()]) +Level = Stringfield ("level", validators=[Required ()]) -  $  $ classSubmitForm (Form): -Submit = Submitfield ("Save")

The relationship summary is the project classification under the interface, the interface has parameters, parameters are divided into request parameters; return parameters

Background management is also added:

GitHub Address: Https://github.com/cllovewxq/pythonapi

This way Bo Master did not put the user management completed, and the use of the project process has a user password, then use: admin/123456

Flask Framework Learning Notes (API Interface management platform V2.0)

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.