Skip to content

Latest commit

 

History

History
197 lines (140 loc) · 5.33 KB

README.md

File metadata and controls

197 lines (140 loc) · 5.33 KB

legaldb

MIT license Code style: black

CC Legal Database: curated repository of Case Law and Scholarship data from around the world in a Django based website.

legaldb.creativecommons.org

Code of conduct

CODE_OF_CONDUCT.md:

The Creative Commons team is committed to fostering a welcoming community. This project and all other Creative Commons open source projects are governed by our Code of Conduct. Please report unacceptable behavior to [email protected] per our reporting guidelines.

Contributing

See CONTRIBUTING.md.

Development setup

For information on learning and installing the prerequisite technologies for this project, please see Foundational technologies — Creative Commons Open Source.

Copy .env.template and set environment variables (like DJANGO_DEBUG_ENABLED=True for local development and testing) and secret keys in a .env file.

Please read the comments in the .env file for specific instructions to get it to work locally.

cp .env.template .env

Using docker compose

Start (and Build) the Servers

Start Django server (backed by PostgreSQL server ) at 127.0.0.1:8000:

docker compose up

Initialize database with development data

The following utility will reset the database, run migrations, configure an admin user, and load the developiment data:

  1. In a terminal window / command line:
    docker compose up
  2. In a second terminal window /command line:
    ./bin/init_data.sh

Helper commands

All of the following helper commands assume the App and DB services are running:

  • bin/check.sh
    • Perform static analysis checks and reformat Python code
  • bin/dump_data.sh
    • Dump Django data with processing to remove PII and unapproved entries
    • Not normally invoked during development
  • bin/init_data.sh
    • Initialize Django application data (!!DANGER!!)
  • process_data.py
    • Process YAML data from Django dumpdata to remove PII and unapproved entries.
    • called by bin/dump_data
    • Not normally invoked during development
  • bin/release_tasks
    • Heroku release script
    • Not normally invoked during development
  • bin/test.sh
    • Run Django collectstatic, check, and test (unit tests)

Execute Commands

To execute any commands inside the app docker container, follow this format:

docker compose exec app ./manage.py DJANGO COMMAND HERE

or

docker compose exec app sh -c "SHELL COMMAND HERE"

Examples:

  • Create a Super User:
    docker compose exec app ./manage.py createsuperuser
    • (better to use bin/init_data.sh)
  • Collect static files:
    docker compose exec app ./manage.py collectstatic
  • Compress content:
    docker compose exec app ./manage.py compress
  • Run tests:
    docker compose exec app ./manage.py test
    • (better to use bin/test.sh)

Pipenv

The Python modules are managed by Pipenv. If development requires new Python modules, remember to also rebuild your Docker containters.

Webpack

Open another terminal and navigate to webpack folder using:

cd webpack

To install webpack dependencies use:

npm install

or alternatively to install from package-lock.json use:

npm ci

If you want to make changes to scss files during development run:

npm run watch

otherwise run the following command

npm run build

After made code changes and before commit, check code style from main directory using.

Code Style

After making changes in code and before commit, check code style:

./bin/check.sh

Development Blog Posts

Posts in the Outreachy May 2020 round: CC Legal Database series

Guides

The guides/ folder includes:

License