Programmers learn & share
+1 vote

Problem :

I am getting bellow flask app error
error: could not locate flask application. you did not provide the flask_app environment variable.
by (6.9k points)   | 110 views

1 Answer

0 votes

Solution :

When I dropped sudo from sudo flask run, Flask finds $FLASK_APP. But, I got the error message socket.error as: [Errno 13] Permission denied. I can't see a way around this, as Flask cannot find $FLASK_APP when I run as superuser. 

Still I managed to run Flask by changing the port from 80 to 5000 and dropping sudo with flask run. This is running fine now. 

I was able to run flask db init after dropping and recreating my database, and removing calls to db.create_all.

by (36.1k points)  
2,182 questions
2,454 answers
241 users