I am new in creating API. But I created one like this code :
app = Flask(__name__)
@app.route("/",methods=['GET','POST'])
def hello():
try :
with open('logs.txt','a') as f :
f.write(f"{datetime.now()}\n")
except Exception as e :
print(str(e))
value = request.args.get('symbol')
result = database.get_symbol(value)
return jsonify(result)
if __name__ == '__main__':
app.run(debug=False)
So I have a VPS (Virtual private server) with windows7 on it and I am trying to run my flask app in it. but when I run it the code will be like this :
main.py:443: DeprecationWarning: use options instead of chrome_options
return webdriver.Chrome(chrome_options=option)
* Serving Flask app "main" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
But when I run it in my server and trying to access it using my own personal computer with this code :
curl [ip_address]:5000/?symbol=value
it give me an error :
curl: (7) Failed to connect to [IP] port 5000: Connection refused
How can people use this API?
can I just deploy it in developer mode?