Bottle loading time for network server is extremely slow

So, I'm currently working on a basic small website to work on my network. However, I am facing some problems. When I start the server, on the computer on which the server is running, I can access the pages very quickly. However, when I try to access the same page on another computer on my network, it loads EXTREMELY slowly. This is because I used dev. server, not something like Paste or Apache? (It should also be noted that when I look at the server computer, the request logs come in 5-6 seconds after I asked for it in a browser on another computer)

My code is below:

Access to the page:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta http-equiv="content-type"
 content="text/html; charset=ISO-8859-1">
  <title>index</title>
  <link type="text/css"
 href="cssfiles/mainpagecss.css"
 rel="stylesheet">
</head>
<body>
<table
 style="width: 100%; text-align: left; margin-left: auto; margin-right: auto;"
 border="0" cellpadding="2" cellspacing="2">
  <tbody>
    <tr>
      <td>
      <h1><span class="headertext">
      <center>Network
Website</center>
      </span></h1>
      </td>
    </tr>
  </tbody>
</table>
%if name!='none':
    <p align="right">signed in as: {{name}}</p>
%else:
    pass
%end
<br>
<table style="text-align: left; width: 100%;" border="0" cellpadding="2"
 cellspacing="2">
  <tbody>
    <tr>
      <td>
      <table style="text-align: left; width: 100%;" border="0"
 cellpadding="2" cellspacing="2">
        <tbody>
          <tr>
            <td style="width: 15%; vertical-align: top;">
            <table style="text-align: left; width: 100%;" border="1"
 cellpadding="2" cellspacing="2">
              <tbody>
                <tr>
                  <td>Home<br>
                  <span class="important">Teamspeak Download</span><br>
                  <span class="important">Teamspeak Information</span></td>
                </tr>
              </tbody>
            </table>
            </td>
            <td style="vertical-align: top;">
            <table style="text-align: left; width: 100%;" border="1"
 cellpadding="2" cellspacing="2">
              <tbody>
                <tr>
                  <td>
                  <h1><span style="font-weight: bold;">Network Website</span></h1>
To find all of the needed information relating to the network social
capabilities, please refer to the links in the side bar.</td>
                </tr>
              </tbody>
            </table>
            </td>
          </tr>
        </tbody>
      </table>
      </td>
    </tr>
  </tbody>
</table>
</body>
</html>

Css:

  .headertext { color: rgb(51, 51, 51);
    }

  .bodytext {  }

  .important { font-weight: bold;
    }

Server:

from Bottle import route,run,template,request,static_file



@route('/')
def home():
    return template('Templates/',name=request.environ.get('REMOTE_ADDR'))

run(host='Work-PC',port=9999,debug=True)
+5
3

Bottle .

, Bottle . .

  • cherrypy:

    easy_install cherrypy

  • :

    run (app, host = '0.0.0.0', port = 8080, debug = True, reloader = True, server = 'cherrypy')

: easy_install : http://pypi.python.org/pypi/distribute

!

+8

, , . (WSGIRef from wsgiref.simple_server) DNS GET, POST .., IP- -. , DNS-.: (

bottle.py , rDNS, BaseHTTPRequestHandler.address_string(), :

bottle.py

 class WSGIRefServer(ServerAdapter):
     def run(self, handler): # pragma: no cover
         from wsgiref.simple_server import make_server, WSGIRequestHandler
+        self.fast = True
+        self.quiet = False
+        if self.fast and self.quiet:  # disable logging and rDNS
+            class FastAndQuietHandler(WSGIRequestHandler):
+                def address_string(self): return self.client_address[0]
+                def log_request(*args, **kw): pass
+            self.options['handler_class'] = FastAndQuietHandler
+        elif self.fast:  # disable Reverse DNS Lookups -> faster service
+            class FastHandler(WSGIRequestHandler):
+                def address_string(self): return self.client_address[0]
+            self.options['handler_class'] = FastHandler
-        if self.quiet:
+        elif self.quiet:  # disable action entries to web-log
             class QuietHandler(WSGIRequestHandler):
                 def log_request(*args, **kw): pass
             self.options['handler_class'] = QuietHandler
         srv = make_server(self.host, self.port, handler, **self.options)
         srv.serve_forever()

, , , .

: . fooobar.com/questions/893155/...

+8

All Articles