First, to talk about the hole encountered:
1. Package references for Linux under:
1 """2 The path structure is as follows:3 ./project4 ./bin5 ./api6 """7 #to reference the contents of apilib.py in the API directory under main.py in the bin directory8 ImportSYS9Sys.path.append (".. /")Ten fromApi.apilibImportFunc
2. When running large system, the execution directory of the script that you initiated under/root is also/root, so pay attention to the absolute path and relative path in programming.
3, under Linux How to adjust the bad Httpbasicauth
1 #The configuration of Httpbasicauth under Linux can only be defined in the app startup file. It hasn't been tuned so far:2 #can only be as follows:3Apiapp = Flask (__name__)4 #APIAPP.config.from_pyfile (".. /settings/flaskcconfig.py ", Silent=true)5 #in this way, the mother will make mistakes, do not know where the problem is!!! 6apiapp.config['Basic_auth_username'] ='******'7apiapp.config['Basic_auth_password'] ='******'8apiapp.config['DEBUG'] = True
Second, the request module in flask is important to obtain the relevant content of the requested message:
1. Request for data transfer:
1 request.forms.get ("xxxx")2 request.args.get (" xxxx ")
2. Request for Cookies
1 request.cookies
3, characters commonly used paragraph:
1Request.headers#Headers2Request.Files#Upload Files3Request.stream#Stream Data4Request.data#Data5Request.method#get \post \head\ ...6 Request.path7 Request.script_root8 Request.base_url9 Request.urlTenRequest.url_root
The request module for Python flask and the pits encountered in flask programming