flask-script
# Used to achieve similar django in python3 manage.py runserver ... similar command # installation: pip3 install flask-script
use
from flask_script Import Manager app = the Flask ( the __name__ ) Manager = Manager (app) # instantiated directly Manager to pass into the app ... IF the __name__ == ' __main__ ' : manager.run () # after performing direct: python3 manage the runserver .py # python3 manage.py the runserver --help # can pass parameters, port, etc.
Custom command
manager.command @ DEF Custom (Arg): "" " custom command Python manage.py Custom 123 : param Arg: : return: " "" Print (Arg) @ manager.option ( ' -n ' , ' --name ' , dest = ' name ' ) # @ manager.option (' - U ',' --url ', dest =' URL ') DEF cmd (name, URL): "" " custom command (-n may written --name) execution: Python manage.py cmd --N LQZ --url http://www.oldboyedu.com : param name: : param url: :return: """ print(name, url)
pipreqs
# The project relies set out # is generally used in conjunction with a virtual environment, otherwise the whole environment package are listed. # Installation PIP3 install pipreqs # use in the project root directory ./ pipreqs # After generating requirements.txt files, you can download this file in accordance with all the dependencies # usage: pip install -r requriements.txt to the case of Windows systems, will be reported coding errors (a UnicodeDecodeError: ' GBK ' CODEC CAN ' T 0xa8 in decode byte position 24: Illegal multibyte The Sequence) when used, the encoding format specified pipreqs ./ --encoding = utf8