Home > OS >  conda and flask not logging anything
conda and flask not logging anything

Time:07-31

I just started with python and am confused that my code does not behave the way the examples show.

from flask import Flask
app = Flask(__name__)

@app.route('/')
def index():
  return 'Server Works!'
  
@app.route('/greet')
def say_hello():
  return 'Hello from Server'

conda run -n myenv flask run

after this command, nothing appears, yet the app works.

Using VSCODE and Windows 10 Terminal

CodePudding user response:

The reason you don't see anything in the console is because conda run capture your output.

If you want to run the above command with conda run, you need to use the folowing command

conda run --no-capture-output  flask run

But I think you shouldn't run command like that. Activate the environment first and do anything in activated shell.

conda activate -n myenv
flask run
  • Related