commit 25be11255418afc4a45ccf0a5f44b89f64c3f2c2
Author: David Sorber <david.sorber@gmail.com>
Date:   Sun Jul 5 11:06:35 2015 -0400

    Adding apache config and web interface install script.

diff --git a/software/bookmark_library/bmklib/web/base_controller.py b/software/bookmark_library/bmklib/web/base_controller.py
index e591c0e..ba0ad9e 100644
--- a/software/bookmark_library/bmklib/web/base_controller.py
+++ b/software/bookmark_library/bmklib/web/base_controller.py
@@ -2,7 +2,7 @@ import os
 
 from genshi.template import TemplateLoader
 
-BASE_PATH = '/home/dsorber/Documents/phalanx-repo/software/bookmark_library/'
+BASE_PATH = '/home/dsorber/Documents/repo/software/bookmark_library/'
 DB_PATH = os.path.join('/var/www', 'bookmarks.db')
 TEMPLATE_PATH = os.path.join(BASE_PATH, 'bmklib', 'web', 'templates')
 
@@ -17,7 +17,7 @@ class BaseHTMLController(object):
         
         # Load and store the template
         loader = TemplateLoader(TEMPLATE_PATH, auto_reload=True)    
-        self.template = loader.load(template_name)
+        self.template = loader.load(template_name, encoding='utf-8')
         
         # This dict is used generate the response body
         self.content = {}
@@ -83,6 +83,7 @@ class TestController(BaseTextController):
     def build_content(self):
         self.body = 'hello there handsome'
 
+
 class BaseRedirectController(object):
     
     def __init__(self, environ):
diff --git a/software/bookmark_library/bmklib/web/config/bmklib.conf b/software/bookmark_library/bmklib/web/config/bmklib.conf
new file mode 100644
index 0000000..ac05e7f
--- /dev/null
+++ b/software/bookmark_library/bmklib/web/config/bmklib.conf
@@ -0,0 +1,33 @@
+<VirtualHost *:80>
+
+        ServerAdmin webmaster@localhost
+        DocumentRoot /var/www/html
+
+        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
+        # error, crit, alert, emerg.
+        # It is also possible to configure the loglevel for particular
+        # modules, e.g.
+        #LogLevel info ssl:warn
+
+        ErrorLog ${APACHE_LOG_DIR}/error.log
+        CustomLog ${APACHE_LOG_DIR}/access.log combined
+
+
+        # Replace "/home/dsorber/Documents" with the path containing `bmklib.wsgi`
+        <Directory /home/dsorber/Documents>
+           Options All
+           AllowOverride All
+           Require all granted
+        </Directory>
+
+        # Modify this path to be the absolute path to the bmklib.wsgi file
+        #WSGIScriptAlias /bmk    /home/dsorber/Documents/repo/software/bookmark_library/bmklib/web/bmklib.wsgi
+        WSGIScriptAlias /bmk    /var/www/bmklib.wsgi
+
+        Alias /htdocs /var/htdocs
+        <Directory /var/htdocs>
+                Require all granted
+        </Directory>
+
+</VirtualHost>
+
diff --git a/software/bookmark_library/bmklib/web/controllers/main.py b/software/bookmark_library/bmklib/web/controllers/main.py
index c9dfa6c..cf889b4 100644
--- a/software/bookmark_library/bmklib/web/controllers/main.py
+++ b/software/bookmark_library/bmklib/web/controllers/main.py
@@ -26,7 +26,6 @@ class MainPageController(BaseHTMLController):
         db.execute("SELECT COUNT(*) FROM bookmarks")
         self.content['total_num_bmks'] = db.fetchone()[0]
         
-        
         links = {'All Bookmarks': self.build_link('bookmarks'), 
                  'All Tags': self.build_link('tags')}
         
diff --git a/software/bookmark_library/bmklib/web/htdocs/Roboto-Regular.ttf b/software/bookmark_library/bmklib/web/htdocs/Roboto-Regular.ttf
new file mode 100644
index 0000000..3e6e2e7
Binary files /dev/null and b/software/bookmark_library/bmklib/web/htdocs/Roboto-Regular.ttf differ
diff --git a/software/bookmark_library/bmklib/web/htdocs/css/bmk_main.css b/software/bookmark_library/bmklib/web/htdocs/css/bmk_main.css
index 54382f2..fd0da24 100644
--- a/software/bookmark_library/bmklib/web/htdocs/css/bmk_main.css
+++ b/software/bookmark_library/bmklib/web/htdocs/css/bmk_main.css
@@ -1,5 +1,10 @@
+    @font-face {
+        font-family: Roboto;
+        src: url(htdocs/Roboto-Regular.ttf);
+    }
+
     body {
-        font-family: sans-serif;
+        font-family: Roboto, sans-serif, Arial;
         font-size: 16px;
         margin-left: 0px;
         margin-right: 0px;
diff --git a/software/bookmark_library/bmklib/web/install.sh b/software/bookmark_library/bmklib/web/install.sh
index 062f8f7..637f2d4 100755
--- a/software/bookmark_library/bmklib/web/install.sh
+++ b/software/bookmark_library/bmklib/web/install.sh
@@ -1,8 +1,47 @@
 #!/bin/bash
 
 # This is a very, very crude way of doing this
+APACHE_DIR="/etc/apache2/sites-available/"
 HTDOCS_DIR="/var/htdocs/"
 SERVE_DIR="/var/www/"
 
+if [[ $EUID -ne 0 ]]; then
+    echo "This script must be run as root" 1>&2
+    exit 1
+fi
+
+if [ ! -d "$SERVE_DIR" ]; then
+    echo "ERROR: $SERVE_DIR does not exist!"
+    echo "Make sure apache is installed and then try again"
+    exit 2
+fi
+
+if [ ! -d "$APACHE_DIR" ]; then
+    echo "ERROR: $APACHE_DIR does not exist!"
+    echo "Make sure apache is installed and then try again"
+    exit 2
+fi
+
+echo -e "\nInstalling bmklib web interface\n"
+
+# Copy the .wsgi into place
+echo "Copying .wsgi file..."
 cp bmklib.wsgi $SERVE_DIR
-cp htdocs/css/* $HTDOCS_DIR/css/
+
+# Copy htdocs into place
+if [ ! -d "$HTDOCS_DIR" ]; then
+    echo "Creating $HTDOCS_IDR..."
+    mkdir -p $HTDOCS_DIR
+fi
+
+echo "Copying htdocs..."
+cp -R htdocs/* $HTDOCS_DIR/
+
+# Copy the apache config into place and then enable it
+echo "Copying apache config..."
+cp config/bmklib.conf $APACHE_DIR
+a2ensite bmklib
+echo "Restarting apache..."
+service apache2 restart
+
+echo "DONE"
diff --git a/software/bookmark_library/bmklib/web/templates/main.html b/software/bookmark_library/bmklib/web/templates/main.html
index db534cd..469f261 100644
--- a/software/bookmark_library/bmklib/web/templates/main.html
+++ b/software/bookmark_library/bmklib/web/templates/main.html
@@ -1,5 +1,4 @@
-<html xmlns="http://www.w3.org/1999/xhtml"
-      xmlns:py="http://genshi.edgewall.org/">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://genshi.edgewall.org/">
 <head>
 <title>Bookmark Library</title>
 <link rel="stylesheet" type="text/css" href="../htdocs/css/bmk_main.css"></link>
@@ -7,9 +6,7 @@
 
 <body>
 <h1>Bookmark Library</h1>
-
 <p>There are currently ${total_num_bmks} bookmarks in the library.</p>
-
 <ul>
     <li py:for="title, link in links.items()"><a href="${link}">${title}</a></li>
 </ul>
