Skip to content

Installation

These instructions install Django Packages on your computer, using Docker.

If you run into problems, see the Troubleshooting section.

Set up Tooling

You'll want to make sure your local environment is ready by installing the following tools.

Docker

If you don't have them installed yet, install Docker and docker-compose.

Grab a Local Copy of the Project

Fork the Django Packages project

Clone the Django Packages project using git:

git clone [email protected]:<your-github-username>/djangopackages.git
cd djangopackages

Set Up Your Development Environment

All of the environment variables and settings that are needed to run the project are stored in .env.local.example file.

In order to run the project, you'll need to run the following command:

cp .env.local.example .env.local

Build the Docker Containers

Now build the project using docker-compose:

docker-compose build

Add A GitHub API Token (optional)

Get a GitHub API token and set the GITHUB_TOKEN variable in .env.local to this value. This is used by the GitHub repo handler for fetching repo metadata, and required for certain tests.

Run the Project

To start the project, run:

docker-compose up --detach

Then point your browser to http://localhost:8000 and start hacking!

Create a Local Django Superuser

Now, you'll give yourself an admin account on the locally-running version of Django Packages

Create a Django superuser for yourself, replacing joe with your username/email:

docker-compose run django python manage.py createsuperuser --username=joe --email=[email protected]

And then login into the admin interface (/admin/) and create a profile for your user filling all the fields with any data.

Load Sample Data

We use a Mock system of creating sample data in our tests and for running a development version of the site. To create some development data, just run:

docker-compose run --rm django python manage.py load_dev_data

Formatters, Linters, and other miscellanea

Pre-commit is a tool which helps to organize our linters and auto-formatters. Pre-commit runs before our code gets committed automatically or we may run it by hand. Pre-commit runs automatically for every pull request on GitHub too.

To install the pre-commit hooks:

pip install pre-commit
pre-commit install

To run all pre-commit rules by hand:

pre-commit run --all-files

To run a pre-commit rule by hand:

pre-commit run ruff

Opinionated Setup

A more opinionated set up using the command runner just is also available.