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.