Skip to content
This repository was archived by the owner on Aug 12, 2021. It is now read-only.

Princeton-CDH/winthrop-django

Repository files navigation

winthrop-django

This work is no longer in active development and has been archived.

A web archive of in-progress work at the time development stopped is available in the test-site-archive folder with instructions for playback.


Django web application for The Winthrop Family on the Page project.

Python 3.5 / Django 1.10

Build status Code coverage Code Health Requirements Status

This repo uses git-flow conventions; master contains the most recent release, and work in progress will be on the develop branch. Pull requests should be made against develop.

Development instructions

Initial setup and installation:

  • recommended: create and activate a python 3.5 virtualenv:

    virtualenv ppa -p python3.5
    source ppa/bin/activate
    
  • Use pip to install required python dependencies:

    pip install -r requirements.txt
    pip install -r dev-requirements.txt
    
  • Copy sample local settings and configure for your environment:

    cp ppa/local_settings.py.sample ppa/local_settings.py
    
  • Create a database, configure in local settings, and run migrations:

    python manage.py migrate
    
  • Create two new Solr cores with the project configuration and managed schema, using the core/collection names for development and testing that you configured in local settings:

    solr create -c SOLR_CORE -d path/to/winthrop-django/solr_config
    solr create -c SOLR_TEST_CORE -d path/to/winthrop-django/solr_config
    
  • Run the manage command to configure the schema:

    python manage.py solr_schema
    

    The manage command will automatically reload the core to ensure schema changes take effect.

  • Then index data into Solr:

    python manage.py index
    

Frontend development setup:

  • django-compressor dependencies: you need Node.js and a js package manager (npm or yarn). Install dependencies with the relevant install command for your package manager - for npm:

    npm install
    

    for yarn:

    yarn
    

    if you wish to install dependencies globally, take a look at the optional settings for django-compressor-toolkit.

Tests

Python unit tests are written with py.test but use Django fixture loading and convenience testing methods when that makes things easier. To run them, first install development requirements:

pip install -r dev-requirements.txt

Run tests using py.test. Note that this currently requires the top level project directory be included in your python path. You can accomplish this either by calling pytest via python:

python -m pytest

Or, if you wish to use the pytest command directly, simply add the top-level project directory to your python path environment variable:

setenv PYTHONPATH .  # csh
export PYTHONPATH=.  # bash

Make sure you configure a test solr connection and set up an empty Solr core using the same instructions as for the development core.

Documentation

You can view documentation for the current master branch on GitHub Pages.

Documentation is generated using sphinx. To generate documentation, first install development requirements:

pip install -r dev-requirements.txt

Then build documentation using the customized make file in the docs directory:

cd sphinx-docs
make html

When building for a release make docs will create a folder called docs, build the HTML documents and static assets, and force add it to the commit for use with Github Pages.

License

This project is licensed under the Apache 2.0 License.