Team:Exeter/lab book/glyco/wk6

From 2012.igem.org

(Difference between revisions)
 
Line 156: Line 156:
   
   
  </table>
  </table>
 +
 +
<table width="980" align="center" cellspacing="20">
 +
<tr align="center">
 +
  <td>
 +
  <font color="#57B947" size="1" face="Verdana">
 +
    <p><u>Website Designed and Built by: Ryan Edginton, James Lynch & Alex Clowsley</u> &nbsp;&nbsp;|&nbsp;&nbsp;
 +
    <a href="https://igem.org/Team.cgi?id=764" style="color:#57B947" target="_blank"><u>Contact Us</u></a>  &nbsp;&nbsp;|&nbsp;&nbsp;
 +
    <a href="https://2012.igem.org/Team:Exeter/site_map" style="color:#57B947"><u>Site Map</u></a></p>
 +
  </font>
 +
  </td>
 +
</tr>
 +
</table>
</body>
</body>
</html>
</html>

Latest revision as of 00:24, 27 September 2012

ExiGEM2012 Lab Book Glyco wk5

Glycobase: 30th July - 3rd August 2012

30/07/12

Using Bottle.Py

Completed example, importing 'route' using '@route('/attempt/:name') and running on localhost port 8080.

Ran the app.py python file using Windows command prompt. Output shows Bottle server listening on 'http://localhost:8080/'.

Went to URL http://localhost:8080/attempt/one.

Union operator used like an AND function for select statements.

The message 'hello iGEM team' displayed, written to be in localhost port 8080.

SQL count could be useful for the dropdown menu.

Completed second example using dynamic route http://localhost:8080/dynamic. The web address 'dynamic' is stored as variable unknown. This is printed on the screen and the web address changed.

Third example uses more than one dynamic route.

Expected output:
path 1:p1
path 2:p2

Web browser input http:/localhost:8080/p1/p2, where p1 and p2 are now variables recorded under path 1 and path 2.

01/08/12

More bottle examples completed along with http request methods.

02/08/12

Routing static files

Static files (images or CSS stylesheets) are not served automatically so must add a route and call back to control where to find the files. Thus, the CSS is interpreted within the HTML.

Web based to do list

Each page visible in the browser is generated when the URL is called. A 'route' in the bottle is an address on the server. When called, Bottle accepts the call and checks if there is any Python function defined. Bottle then executes any code called.

Important point is the decorator statement @route('toDO'). Functions are bound to this route. Bottle returns result of function bound to route. You may bind multiple routes to functions but each route can only have one function.

Bottle Template to Format the Output

Bottle expects a string or list of strings from a function.
The string can be text formatted using HTML markup.
Templates are stored as .tpl files and can be called from within functions.
They contain a mix of HTML mark-up and Python statements.
Every line beginning with % is interpreted as Python code. All condition must be closed with % end.
Access a variable within a non-python code line with double curly braces.

Using GET or POST values studied.

Reviewed 'dynamic routes using regular expressions', returning static files and how to catch errors.

Website Designed and Built by: Ryan Edginton, James Lynch & Alex Clowsley   |   Contact Us   |   Site Map