new reading environment for version 5.0 of the Perseus Digital Library
Clone or download
paltman Merge pull request #322 from scaife-viewer/enable-non-root-hosting
Add support for hosting at a path other than root
Latest commit 6f51619 Jan 8, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci Some clean up Jan 7, 2019
bin switch to perseus.org Mar 10, 2018
data initial library metadata from Alison Dec 24, 2017
fixtures use same site name for dev instance Mar 13, 2018
scaife_viewer Only do dict lookup once Dec 19, 2018
static/src Default base url should have a slash Dec 19, 2018
.babelrc WIP: Updates Dec 9, 2018
.buildpacks EC bits Sep 26, 2017
.dockerignore added Dockerfile Nov 8, 2017
.eslintignore added .eslintignore Sep 29, 2017
.eslintrc.json Some clean up Jan 7, 2019
.gitignore WIP: Updates Dec 9, 2018
AUTHORS.md Updating authors May 4, 2018
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md Mar 8, 2018
Dockerfile Some clean up Jan 7, 2019
LICENSE Some clean up Jan 7, 2019
Pipfile Upgrade to Python 3.7.1 Dec 11, 2018
Pipfile.lock Upgrade to Python 3.7.1 Dec 11, 2018
Procfile fixed preloading Nov 1, 2017
README.md Add some instructions for hosting off-root Dec 19, 2018
cloudbuild-dev.yml fixed CB yaml Feb 9, 2018
cloudbuild-production.yml fixed CB yaml Feb 9, 2018
docker-compose.yml Add docker-compose.yml for running scaife-viewer server + PostgreSQL … Mar 12, 2018
docker-run-server.sh Use `exec honcho start` web to ensure honcho and gunicorn correctly r… Mar 12, 2018
gondor.yml updated EC config for site move Mar 2, 2018
manage.py pinax start account Sep 22, 2017
package-lock.json Merge branch 'dev' into fix-pagination Dec 14, 2018
package.json Merge branch 'dev' into fix-pagination Dec 14, 2018
setup.cfg added quote checking Mar 13, 2018
webpack.config.js Add support for hosting at a path other than root Dec 18, 2018

README.md

Scaife Digital Library Viewer

The Scaife Viewer is the new reading environment for the Perseus Digital Library.

See Ways to Contribute.

Getting Started

Requirements:

  • Python 3.7.1
    • pipenv
  • Node 10.7
  • PostgreSQL 9.6
  • Elasticsearch 6

First, set up a database to use for local development:

createdb scaife-viewer

This assumes your local PostgreSQL is configured to allow your user to create databases. If this is not the case you might be able to create the user yourself:

createuser --username=postgres --superuser $(whoami)

Install the Node and Python dependencies:

npm install
pipenv install --dev

Setup the database:

pipenv run python manage.py migrate
pipenv run python manage.py loaddata sites

Seed the text inventory to speed up local development:

curl -s "https://scaife-cts-dev.perseus.org/api/cts?request=GetCapabilities" > ti.xml

You should now be set to run the static build pipeline and hot module reloading:

npm start

In another terminal, start runserver:

pipenv run python manage.py runserver

Browse to http://localhost:8000/.

Note that, although running Scaife locally, this is relying on the Nautilus server at https://scaife-cts-dev.perseus.org to retrieve texts.

Translations

Before you work with translations, you will need gettext installed.

macOS:

brew install gettext
export PATH="$PATH:$(brew --prefix gettext)/bin"

To prepare messages:

python manage.py makemessages --all

If you need to add a language; add it to LANGUAGES in settings.py and run:

python manage.py makemessages --locale <lang>

Hosting Off-Root

If you need to host at a place other than root, for example, if you need to have a proxy serve at some path off your domain like http://yourdomain.com/perseus/, you'll need to do the following:

  1. Set the environment variable, FORCE_SCRIPT_NAME to point to your script:
    export FORCE_SCRIPT_NAME=/perseus  # this front slash is important
  1. Make sure this is set prior to runing npm run build as well as prior to and part of your wsgi startup environment.

  2. Then, you just set your proxy to point to the location of where your wsgi server is running. For example, if you are running wsgi on port 8000 you can have this snippet inside your nginx config for the server:

    location /perseus/ {
        proxy_pass        http://localhost:8000/;
    }

That should be all you need to do.