CC Legal Database: curated repository of Case Law and Scholarship data from around the world in a Django based website.
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
See CONTRIBUTING.md
. It contains some general instructions
that should be followed when contributing to any of the Creative Commons
open-source repositories.
Copy .env.template
and set environment variables (like
DJANGO_DEBUG_ENABLED=True
for local development and testing) and secret keys
in a .env
file.
cp .env.template .env
Ensure that you have Docker and Docker Compose installed on your system For installation instructions refer: Get Docker | Docker Documentation
Start Django server (backed by PostgreSQL server ) at 127.0.0.1:8000:
docker compose up
Run the migrations to create database schema (we use Postgresql in this case):
docker compose exec app ./manage.py migrate
(Required after initial build)
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
- 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
NOTE: The prefered method is Using docker compose.
To follow these instructions, Python 3 and Pipenv are required.
Install dependencies with pipenv.
pipenv install --dev
Run the migrations to create the database (we use Postgresql in this case).
pipenv run ./manage.py migrate
The next step is to create an admin account for Django admin.
pipenv run ./manage.py createsuperuser
Finally you can start a development server with:
pipenv run ./manage.py runserver
and see a local version of the website at 127.0.0.1:8000.
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.
After making changes in code and before commit, check code style.
pipenv run isort .
pipenv run black .
pipenv run flake8 .
-
Open https://github.com/creativecommons/legaldb in your browser, it will redirect you to the github repository of Creative Common's legaldb.
-
Here you will see all the folders and files present in the repository, somewhat at the middle-right of the screen you will find a green button saying "Code" with a arrow within it.
-
Tap on the arrow and you have three options before you, first will be HTTPS, second will be SSH and third will be GitHub CLI.
-
By default you will be on the first option HTTPS and that is what we will use to clone the code.
-
In this option (First one HTTPS) you will see a URL or Link in a box below which "Clone using the web URL" will be written, simply copy the URL or Link.
-
Now open the code editor you use (Visual Studio Code recommended and used here), then open the folder you want to clone the code in.
-
Then open bash terminal within your code editor and type the following git command:
git clone https://github.com/creativecommons/legaldb.git
-
Here in this command I have already pasted the URL or Link you have copied from github.
-
Press Enter after typing this command and the code will be cloned in your code editor and you are free to edit it.
-
Recommended: Use of Visual Studio Code and knowledge of Git and GitHub and some terminal commands. (Can watch some videos on Youtube to know about Git and GitHub)
Posts in the Outreachy May 2020 round: CC Legal Database series
See deploy_to_heroku.md
.