Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

conda and flask not logging anything

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Using VSCODE and Windows 10 Terminal

>Solution :

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

And I think you should change from VSCode to Pycharm.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading