python - can't pass arguments to running flask webserver -
from android app make pictures raspberry pi via ssh , try upload them website flask. before app ask users enter code , want code in url, why need argparse
.
i want server running , in meantime want pass new urls script creates pages. when i'm running pitonka.py
, add arguments, tnb_flask.py
doesn't them.
what can solution?
thanks in advance!
pitonka.py:
flask import flask import argparse import random tenor = '' def tuzok(): if args.arg_name == "az": else: tenor = '' if args.arg_name == '': tenor = '' else: tenor = args.arg_name print("tenor", tenor) if __name__ == "__main__": parser = argparse.argumentparser() parser.add_argument("arg_name", help="enter function's name", type=str, default ="az") args = parser.parse_args() tuzok()
tnb_flask.py
flask import flask pitonka import * app = flask(__name__) @app.route('/') def index(): denis = 25 print("tenor:+", tenor, "+") to_ret = "tenor:+" + tenor+ "+\n" + str(denis) return to_ret if __name__ == "__main__": app.run(debug=true) if tenor != "az": print("nem az!!!") @app.route('/tuna/<tenor>') def index__(numbi): return 'working: args.arg_name %s' % tenor else: print("azzal egyezik meg")
Comments
Post a Comment