So i am currently working on a basic little website to run for my network. However, i am running into some problems. When i run the server, on the computer that is running the server, i can access the pages extremely quickly. However, when i try to access the same page on a different computer on my network, it loads EXTREMELY slowly. Is it because im using the dev. server and not something like Paste or Apache? (also to note, when im looking at the server computer, the logs for the requests come in about 5-6 seconds after i have requested it on my browser on the other computer)
My code is below:
Page being accessed:
<!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's 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)
I had the same delay issue while trying to test a Bottle app from another PC on the same network.
The solution was to run Bottle using a better, multi-threaded server. cherrypy worked for me.
Install cherrypy:
easy_install cherrypy
Change Bottle to run using cherrypy:
run(app, host=’0.0.0.0′, port=8080, debug=True, reloader=True, server=’cherrypy’)
Note: easy_install it comes with Distribute: http://pypi.python.org/pypi/distribute
Good luck!