Hello Graham and community,
I have a Raspberry Pi running on the latest version of Raspbian and I am wondering if I can set it up as a Flask server that can be reached over internet. I have never done a project like this before and I am wondering if this can be done using mod_wsgi? Furthermore is there any documentation or tutorial instructions that you can refer me to?
I have currently set up using this configuration.
- My router has a static ip and I have ensured that my raspberry pi has a static IP address on 192.168.0.179.
- Port forwarding is enabled on router using TCP protocol. External port 81 to 192.168.0.179 is routed to internal port 80. Furthermore external port 22 is routed to internal port 22 for 192.168.0.179
My test script looks as below. I hope that when setup correctly I can from any terminal do:
Thanks!
Best regards,
Jian
from flask import Flask
from flask_restful import Resource, Api
app = Flask(__name__)
api = Api(app)
class getNewOrderPostBody(Resource):
def get(self):
return {'data' : "hello world"}
api.add_resource(getNewOrderPostBody, '/getNewOrderPostBodyStruct')
if __name__ == '__main__':
app.run(debug=True)