2

I have a small flask application, and I am trying to host in on my website. It works whenever I run it on my computer, and connect via localhost:5000/ but when I upload to my server, and run the python code, i get multiple errors. When it runs, it only runs on localhost, and can be connected to via the servers console, but when I try to specify that it is to be hosted on all public facing ip's, it says operation not permitted.

here is the terminal output

`/home/public]$ python app.py
Traceback (most recent call last):
  File "app.py", line 14, in <module>
    app.run(host='0.0.0.0', port=port, debug=True)
  File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 841, in 
run
    run_simple(host, port, self, **options)
  File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 
717, in run_simple
    s.bind((hostname, port))
  File "/usr/local/lib/python2.7/socket.py", line 228, in meth
    return getattr(self._sock,name)(*args)
socket.error: [Errno 1] Operation not permitted

`

my app.py

from flask import Flask, render_template, request
import time

app = Flask(__name__)
port=33

@app.route("/")
def index():
    x = int(round(time.time() * 1000))
    return render_template("index.html", stylevar=x)

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

if I connect via the domain name, and navigate to /templates, my index.html file will show, but it wont be running the python code.

Would really appreciate any direction on how to get it to be connected to from the browser. I understand that flask is not meant for production environments, but this is just a small personal project. If there are any other environments other than flask this could be accomplished in, I am willing to try something else.

2
  • Do you have some process already using the port 33 on one of your NIC? Commented Nov 7, 2017 at 16:37
  • @Adonis not that im aware of....how do I check that? Commented Nov 7, 2017 at 16:40

1 Answer 1

1

The script does not have the rights for running with a port below of 1024. If you really need to use port 33 you have to run the script as root.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.