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:

curl http://my_home_static_ip:81/getNewOrderPostBodyStruct and receive the 
“hello world” message as return

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)

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/modwsgi/7500F8C9-FA76-420D-A597-0C8F3961409F%40gmail.com.

Reply via email to