Answer the question
In order to leave comments, you need to log in
How to pass connection parameters via command line?
python app.py oneparameter twoparameter threeparamenter
# app.py
from flask import Flask
app = Flask(name)
if name == 'main':
parameters = get_parameters_from_cli()
app.run(debug=True)
#views.py
@app.route("/")
def hello():
# в некоторых views нужны параметры из командной строки которые я получил в фпйле app.py как их сюда передать?
return "Hello World!"
Answer the question
In order to leave comments, you need to log in
The argparse module will help parse the command line arguments . Save them in the context of the web application module flask.g .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question