Arquivos estáticos de garrafa
Eu tentei ler os documentos para o frasco, no entanto, eu ainda não tenho certeza sobre como funciona o serviço de arquivo estático. eu tenho umindex.tpl
arquivo, e dentro dele tem um arquivo css anexado a ele, e funciona. No entanto, eu estava lendo que o Bottle não serve automaticamente os arquivos css, o que não pode ser verdade se a página for carregada corretamente.
No entanto, enfrentei problemas de velocidade ao solicitar a página. É porque eu não usei oreturn static_file(params go here)
? Se alguém pudesse esclarecer como eles funcionam e como eles são usados ao carregar a página, seria ótimo.
Código do servidor:
<code>from Bottle import route,run,template,request,static_file @route('/') def home(): return template('Templates/index',name=request.environ.get('REMOTE_ADDR')) run(host='Work-PC',port=9999,debug=True) </code>
Índice:
<code><!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> </code>