Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running flask on port 80 in linux [duplicate]

Tags:

python

port

flask

There maybe previous answers to this, So redirect me please, if that's the case I was thinking of running flask on port 80, so I checked if anything is using port 80, as it turns out nothing is running of port 80, so when I type this:

if __name__ == '__main__':  
    app.run(debug=True, host='192.168.4.1' port=int("8081"))

This gives me the web page I want to display, But when I switch to this:

if __name__ == '__main__':  
    app.run(debug=True, host='192.168.4.1' port=int("80"))

I am getting:

PermissionError : [Errno 13] Permission denied

Is there any issue with giving flask or python3 root privileges?

like image 888
Wan Street Avatar asked Jul 18 '18 07:07

Wan Street


1 Answers

You need root to run at port 80.

sudo python app.py

like image 68
uwevil Avatar answered Oct 08 '22 22:10

uwevil