title: Bottle Static files
body: <p>I have tried reading the docs for Bottle, however, I am still unsure about how static file serving works. I have an <code>index.tpl</code> file, and within it it has a css file attached to it, and it works. However, I was reading that Bottle does not automatically serve css files, which can't be true if the page loads correctly.</p>
  
  <p>I have, however, run into speed issues when requesting the page. Is that because I didn't use the <code>return static_file(params go here)</code>? If someone could clear up how they work, and how they are used when loading the page, it would be great. </p>
  
  <p>Server code:</p>
  
  <pre><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></pre>
  
  <p>Index:</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;
  &lt;html&gt;
  &lt;head&gt;
    &lt;meta http-equiv="content-type"
   content="text/html; charset=ISO-8859-1"&gt;
    &lt;title&gt;index&lt;/title&gt;
    &lt;link type="text/css"
   href="cssfiles/mainpagecss.css"
   rel="stylesheet"&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;table
   style="width: 100%; text-align: left; margin-left: auto; margin-right: auto;"
   border="0" cellpadding="2" cellspacing="2"&gt;
    &lt;tbody&gt;
      &lt;tr&gt;
        &lt;td&gt;
        &lt;h1&gt;&lt;span class="headertext"&gt;
        &lt;center&gt;Network
  Website&lt;/center&gt;
        &lt;/span&gt;&lt;/h1&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  %if name!='none':
      &lt;p align="right"&gt;signed in as: {{name}}&lt;/p&gt;
  %else:
      pass
  %end
  &lt;br&gt;
  &lt;table style="text-align: left; width: 100%;" border="0" cellpadding="2"
   cellspacing="2"&gt;
    &lt;tbody&gt;
      &lt;tr&gt;
        &lt;td&gt;
        &lt;table style="text-align: left; width: 100%;" border="0"
   cellpadding="2" cellspacing="2"&gt;
          &lt;tbody&gt;
            &lt;tr&gt;
              &lt;td style="width: 15%; vertical-align: top;"&gt;
              &lt;table style="text-align: left; width: 100%;" border="1"
   cellpadding="2" cellspacing="2"&gt;
                &lt;tbody&gt;
                  &lt;tr&gt;
                    &lt;td&gt;Home&lt;br&gt;
                    &lt;span class="important"&gt;Teamspeak Download&lt;/span&gt;&lt;br&gt;
                    &lt;span class="important"&gt;Teamspeak Information&lt;/span&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                &lt;/tbody&gt;
              &lt;/table&gt;
              &lt;/td&gt;
              &lt;td style="vertical-align: top;"&gt;
              &lt;table style="text-align: left; width: 100%;" border="1"
   cellpadding="2" cellspacing="2"&gt;
                &lt;tbody&gt;
                  &lt;tr&gt;
                    &lt;td&gt;
                    &lt;h1&gt;&lt;span style="font-weight: bold;"&gt;Network Website&lt;/span&gt;&lt;/h1&gt;
  To find all of the needed information relating to the network's social
  capabilities, please refer to the links in the side bar.&lt;/td&gt;
                  &lt;/tr&gt;
                &lt;/tbody&gt;
              &lt;/table&gt;
              &lt;/td&gt;
            &lt;/tr&gt;
          &lt;/tbody&gt;
        &lt;/table&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>