Twisted python not serving file when connecting to the server using public IP address

StackOverflow https://stackoverflow.com/questions/22671061

  •  22-06-2023
  •  | 
  •  

سؤال

I'm working on Python with the Twisted modules. I have the following code

from twisted.web.server import Site
from twisted.web.resource import Resource
from twisted.internet import reactor
from twisted.web.static import File

root = File("test")
factory = Site(root)
reactor.listenTCP(80, factory)
reactor.run()

There is an index.html file within the test directory on the same folder as the python file.

This is the problem: When I load up 'localhost' on the browser, the index.html page gets displayed correctly. However, when I try loading the page using my public IP address, say http://218.248.xxx.180/, the browser waits for a long time and then throws up an error message showing the page is taking too long to respond.

My internet is working fine, (I'm posting this question using the same). I also checked my IP address using http://whatismyip.com, and other sources.

Any ideas what could be wrong?

هل كانت مفيدة؟

المحلول

Solved. Like Broseph pointed out, I didn't have the port forwarded out in the router. Thank you for engaging.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top