Page 1 of 1

web.py over mobile network

Posted: Sat Dec 03, 2016 8:50 pm
by Davies
Hi all ive got a webserver working over my home network using web.py to access a webpage using my IPaddress:8080 but when i switch from my home network to a mobile phone network im unable to access the webpage using my recorded IP.
when ive looked into this further ive found that mobile phone networks have limited IP's so share them as standard and to obtain a static from my provider, but EE dont sell IP's.
i presume this would effect VNC server also?, i havent had chance to set that up yet but was intending on using.
does anybody know another way i can host the webpage using a mobile phone network?, or how i can configure a static ip over mobile network then force the web.py to that?
at the moment im connecting a pi3 to my mobile hotspot through wifi, but do intend on using a sim card module eventually.
the python script im using is

Code: Select all

import web

urls = (
  '/', 'Index'
)

app = web.application(urls, globals())

render = web.template.render('static/')

class Index(object):
    def GET(self):
        es = "OFF"
        return render.index(es=es)

if __name__ == "__main__":
    app.run()
and html is

Code: Select all

$def with (es)

<html>
    <head>
        <title></title>
    </head>
<body>

$if es:
    I just wanted to say <em style="color: green; font-size: 2em;">$es</em>.
$else:
    <em>Hello</em>, world!

</body>
</html>

Re: web.py over mobile network

Posted: Sat Dec 03, 2016 9:23 pm
by B.Goode
If you cannot find a cellphone is provider who will route an inbound connection to your RPi, the alternative might be one of the "RPi phone home" service providers like Weaved, Dataplicity or Particle.

This way your RPi sets up an outbound connection to the providers host, and you make an internet connection to the same host which then gets relayed to your target RPi.