Unofficial, experimental interface to search Catalog of Copyright Entries
 
 
 
Go to file
tmitche2 56312205b5
Merge pull request #2 from EbookFoundation/kim-ui
Kim ui
2020-02-13 20:14:14 -05:00
cce_search Changed html files to jinja templating 2020-02-11 15:19:20 -05:00
.DS_Store Added beginning bootstrap functionalities 2020-01-28 15:17:35 -05:00
.gitignore Update gitignore to include vscode settings folder 2019-10-26 00:11:53 -04:00
LICENSE Add license 2019-07-13 23:54:02 -04:00
Pipfile Updated documentation to reflect Pipenv 2019-11-05 23:58:02 -05:00
Pipfile.lock Added Bootstrap to about 2020-02-03 23:39:54 -05:00
README.md New UI 2019-12-05 15:29:17 -05:00
wsgi.py Launch with gunicorn 2019-07-14 11:22:16 -04:00

README.md

CCE Search Prototype- new UI

An unofficial, experimental interface to search records digitized by NYPL's Catalog of Copyright Entries project.

Forked from Sean Redmond's original protype.

Required software

  • Python 3.7
  • Pipenv

Using Pipenv

Using a virtual environment is very important for ensuring that all work is done in a standardized Python environment. In order to simplify using a virtual environment as well as to give us the ability to create deterministic builds, we use Pipenv.

Installing Pipenv

Mac

brew install pipenv

Note: Mac users can also install through Pip, but using Homebrew is recommended.

Other systems

pip install --user pipenv

Note: You may have versions of Pip installed for both Python 2 and 3. If so, your Python 3 Pip will be called pip3. Check if this is the case by running pip --version and pip3 --version.

First time package install

Run pipenv install in the project's main directory.

Installing new packages

In the project directory, use pipenv install the same way you would use pip install. The package will be installed in the virtual environment, and the Pipfile will be updated.

For example, to install the package requests: pipenv install requests

To specify a specific package version: pipenv install flask==0.12.1

To install packages for development purposes (e.g. ones that aren't required to build and run the project, but are useful for working on it), you can use the --dev flag. For example, pipenv install pytest --dev.

Activating the virtual environment

To activate the virtual environment in your current shell, run pipenv shell. The virtual environment will be indicated by a change to your terminal prompt.

"Locking" the virtual environment

To ensure a deterministic build and "lock" the versions of packages and their subdependencies, run pipenv lock. This will ensure Pipfile.lock is up to date. Do this when any changes are made for the production environment.

Remove an unneeded package

To remove a package from the Pipfile and uninstall it from your virtual environment, use pipenv uninstall.

For example, to remove beautifulsoup: pipenv uninstall beautifulsoup

Run a command in the virtual environment without activating it

pipenv run [command_goes_here]

Closing the virtual environment

After you have activated the virtual environment, press ctrl-d to exit. Your terminal prompt should return to its original appearance.

Always do this when you're finished working in the virtual environment, otherwise your other Python work will screw up the project!

Deploying the project locally

After activating the virtual environment, run the following command from within the root directory of the project:

gunicorn -w=4 wsgi:app

This will run the Flask application on a Gunicorn WSGI server. You can then go to localhost:8000 to use the application.

To close the application, end the process with ctrl-c in your terminal.

TODO:

  • Update Gunicorn config file to automatically specify number of worker processes
  • Address reinstallation of venv (pipenv --rm, pipenv install)