diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..9c2c631 --- /dev/null +++ b/.env.example @@ -0,0 +1,4 @@ +PG_USER=gutenberg +ASSET_DIR=gutenbergsite/gutenberg +PICS_DIR=gutenbergsite/pics +DEV_BASE_PATH=https://dev.gutenberg.org diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..1f8a4bb --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "gutenbergsite"] + path = gutenbergsite + url = git@github.com:gutenbergtools/gutenbergsite.git diff --git a/BaseSearcher.py b/BaseSearcher.py index de15b5b..d7b05dc 100644 --- a/BaseSearcher.py +++ b/BaseSearcher.py @@ -15,6 +15,7 @@ from __future__ import unicode_literals from __future__ import division +from os import environ import datetime import logging @@ -381,6 +382,9 @@ class OpenSearch(object): } def __init__(self): + self.assetdir = environ.get('ASSET_DIR') + self.picsdir = environ.get('PICS_DIR') + self.dev_base_path = environ.get('DEV_BASE_PATH') self.format = None self.page = None self.template = None diff --git a/CherryPy.conf b/CherryPy.conf index 41d1cbb..841cdf8 100644 --- a/CherryPy.conf +++ b/CherryPy.conf @@ -19,7 +19,6 @@ server.thread_pool_max: 20 pghost: 'localhost' pgport: 5432 pgdatabase: 'gutenberg' -pguser: 'postgres' host: 'www.gutenberg.org' host_https: 1 @@ -81,6 +80,10 @@ tools.expires.on: True tools.expires.secs: 0 tools.expires.force: True +[/gutenbergsite] +tools.staticdir.on: True +tools.staticdir.dir: CherryPyApp.install_dir + "/gutenbergsite" + [/index.html] tools.staticfile.on: True tools.staticfile.filename: CherryPyApp.install_dir + '/test/index.html' diff --git a/Page.py b/Page.py index 523ee6d..1d440fc 100644 --- a/Page.py +++ b/Page.py @@ -11,9 +11,9 @@ Base class for all pages. """ - from __future__ import unicode_literals +from os import environ import logging import cherrypy @@ -31,6 +31,9 @@ class Page(object): def __init__(self): self.supported_book_mediatypes = [ mt.epub, mt.mobi ] + self.assetdir = environ.get('ASSET_DIR') + self.dev_base_path = environ.get('DEV_BASE_PATH') + self.picsdir = environ.get('PICS_DIR') @staticmethod diff --git a/gutenbergsite b/gutenbergsite new file mode 160000 index 0000000..31bdcc3 --- /dev/null +++ b/gutenbergsite @@ -0,0 +1 @@ +Subproject commit 31bdcc3cf61d7b6d11e43c568c8a54c9dbb3b34a diff --git a/templates/footer.html b/templates/footer.html index e1e0bde..e6df9a7 100644 --- a/templates/footer.html +++ b/templates/footer.html @@ -19,6 +19,6 @@ - ibiblio + ibiblio diff --git a/templates/menu.html b/templates/menu.html index 5c015e3..054ca2b 100644 --- a/templates/menu.html +++ b/templates/menu.html @@ -8,7 +8,7 @@ @@ -65,7 +65,7 @@ diff --git a/templates/results.html b/templates/results.html index 55dba73..df05cd0 100644 --- a/templates/results.html +++ b/templates/results.html @@ -100,7 +100,7 @@

${e.header}

+ class="cover-thumb" src="${os.dev_base_path}${e.thumb_url}" alt="" /> ${e.title} diff --git a/templates/site-layout.html b/templates/site-layout.html index 95ccfe3..c2efdca 100644 --- a/templates/site-layout.html +++ b/templates/site-layout.html @@ -17,10 +17,10 @@ .page_content a.subtle_link:hover {color:#003366} - - - - + + + +