Forums

Trouble running Flask CLI commands

Hi - on my local docker build I set my FLASK_APP to my manage.py file. EG:

export FLASK_APP=/home/app/manage.py

The manage.py file is:

    app = create_app()
if __name__ == "__main__":
    app.run(host="0.0.0.0", debug=True)

I know in the PythonAnywhere environment I am not using my manage.py to start my Flask app. I assumed that I would need to do this:

export FLASK_APP=/var/www/<my_app_name>_wsgi.py

I get an error:

    from dotenv import load_dotenv
ImportError: No module named dotenv

If anyone has any suggestions on how I can get this working it would be greatly appreciated.

Thank you

I think I am getting close on this.

The problem I am now having when running the Flask command it is failing on an f-string command because it appears to be running python 2.6 from my bash shell. I am not sure how to get the Flask app to run using python 3.6 like my web application is.

I was able to get this working by creating a local copy of the flask script with the python 3.6 executable path at the top of it.

Glad to hear that you made it work!