• Register
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.
6 5 3
6,930 points

Please log in or register to answer this question.

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.

9 7 4
38,600 points

Related questions

0 votes
1 answer 875 views
Problem : I am trying to deploy my Python Flask application in my Azure web app. I had created web app(Flask) and published the code. After publishing it, I am facing below error from the site. The page cannot be displayed because an internal server error ... . But this was the case only in my subscription(my free subscription with MSDN). But it was working fine in the Organisation subscription.
asked Dec 16, 2019 alecxe 7.5k points
1 vote
1 answer 1.2K views
Problem: I installed flask in my system by running the command: pip install flask Collecting flask Downloading https://files.pythonhosted.org/packages/f2/28/2a03252dfb9ebf377f40fba6a7841b47083260bf8bd8e737b0c6952df83f/Flask-1.1.2-py2.py3-none-any.whl (94kB) |████████████████████████████████| ... operable program or batch file. Whats the problem running this can any one tell me? Thanks in advance.
asked May 12, 2020 samhaz 5k points
0 votes
1 answer 393 views
Problem : I am trying to do the file upload & enter the data task into my MongoDB using a flask but I had below error when I filled my form & upload my image: “Bad Request The browser (or proxy) sent a request that this server could ... mypassword, 'email': myemail, 'img_name': file_name})         return render_template('index.html')     else:         return render_template('index.html')
asked Jan 22, 2020 jwilliam 3.9k points
1 vote
1 answer 330 views
Problem : I am facing following sudo path error the command could not be located because '/bin' is not included in the path environment variable.
asked Nov 11, 2019 peterlaw 6.9k points
0 votes
1 answer 14 views
0 votes
1 answer 1.1K views
Problem : When I run my Python code I get the following exception: _csv.error: iterator should return strings, not bytes (did you open the file in text mode?)
asked Nov 18, 2019 peterlaw 6.9k points
1 vote
1 answer 975 views
Problem : I am very new to the C++programming, and so I keep facing the below error saying: Reference to overloaded function could not be resolved; did you mean to call it? Below is my code that is causing me all sorts of troubles : #include <stdio.h> #include < ... have multiple files, all of the files fail to work. Can anyone explain me why my code is failing and can be the solution for it?
asked Dec 30, 2019 alecxe 7.5k points
0 votes
2 answers 317 views
Problem : I am getting bellow error while checking java SE version error: could not find java.dll error: could not find java se runtime environment.
asked Oct 19, 2019 peterlaw 6.9k points
1 vote
1 answer 671 views
Problem: I was unable to find flask module in python but when i try to install it the system says it is already installed: $ python -c "from flaskext.sqlalchemy import SQLAlchemy" Traceback (most recent call last): File "<null>", line 1, in <module> ImportError: No module named ... ', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', It do not exixt. How can I solve this issue?
asked May 4, 2020 samhaz 5k points
0 votes
1 answer 2K views
Problem : MySample.csv contains the below details : NAME Id No Dept Tommy 1 12 CS Jimmy 2 35 EC Bonny 3 21 IT Franky 4 61 EE And my Python file contains the below code : import csv myifile = open('mysample.csv', "rb") read = csv.reader(myifile) for row in read : ... in for row in read : _csv.Error: iterator should return strings, not bytes (did you open the file in text mode?) How should I fix it?
asked Jan 2, 2020 alecxe 7.5k points