Before You Start#

This guide is for experienced Django developers who wish to contribute to the development of the core FairDM framework. If you are looking for information on how to develop a FairDM-powered web application for your research community, please see the Developer Guide.

Prerequisites#

Before contributing to FairDM, you should have:

Required Knowledge#

  • Python: Proficient in Python 3.10+ with strong understanding of object-oriented programming

  • Django: Experience building Django applications; familiarity with models, views, templates, forms, and the Django ORM

  • Git: Comfortable with Git workflows (branching, committing, merging, rebasing)

  • Testing: Understanding of unit testing and test-driven development (pytest)

Required Tools#

Before setting up the development environment, ensure you have the following installed on your system:

  1. Python 3.10 or higher

    • Check version: python --version or python3 --version

    • Download from python.org

  2. Poetry (dependency manager)

  3. Git

    • Check version: git --version

    • Download from git-scm.com

  4. PostgreSQL (for production-like development)

    • Check version: psql --version

    • Download from postgresql.org

    • Alternative: Use Docker to run PostgreSQL in a container

  5. Docker (optional but recommended)

    • Useful for running services (PostgreSQL, Redis) without local installation

    • Download from docker.com

  6. A code editor

    • Recommended: Visual Studio Code with Python and Django extensions

    • Alternatives: PyCharm, Sublime Text, etc.

Tip

New to Django? If you’re not yet comfortable with Django basics, we recommend completing the official Django tutorial before contributing to FairDM.

Setting Up Your Development Environment#

Tip

Recommended: Use Dev Containers. The fastest way to get a fully working development environment is with VS Code Dev Containers. See Dev Container Setup — it requires only Docker and VS Code, and gives you PostGIS, Redis, and Celery out of the box. The rest of this page describes manual setup for contributors who prefer not to use containers.

Follow these steps to set up a local FairDM development environment:

1. Fork and Clone the Repository#

  1. Fork the repository on GitHub:

  2. Clone your fork to your local machine:

    git clone https://github.com/YOUR-USERNAME/fairdm.git
    cd fairdm
    
  3. Add the upstream remote (to keep your fork in sync):

    git remote add upstream https://github.com/FAIR-DM/fairdm.git
    

2. Install Dependencies with Poetry#

  1. Install Python dependencies:

    poetry install
    

    This creates a virtual environment and installs all project dependencies including development tools (pytest, mypy, ruff, etc.).

  2. Activate the Poetry shell (optional but recommended):

    poetry shell
    

    All subsequent commands in this guide assume you’re in the Poetry shell. If you don’t activate the shell, prefix commands with poetry run (e.g., poetry run pytest).

3. Set Up the Database#

FairDM uses PostgreSQL in production, but SQLite is fine for local development.

Option A: Use SQLite (Quick Start)#

SQLite requires no setup. Django will create db.sqlite3 automatically when you run migrations.

4. Run Database Migrations#

Apply all database migrations to set up the schema:

poetry run python manage.py migrate

5. Create a Superuser (Optional)#

To access the Django admin interface:

poetry run python manage.py createsuperuser

Follow the prompts to create an admin account.

6. Run the Development Server#

Start the Django development server:

poetry run python manage.py runserver

Open http://localhost:8000 in your browser. You should see the FairDM homepage.

Tip

Admin interface: Access the admin at http://localhost:8000/admin using the superuser credentials you created.

7. Verify the Setup#

Run the test suite to ensure everything is working:

poetry run pytest

All tests should pass. If any fail, check your environment setup.

Next Steps#

Now that your environment is set up, you can:

See also

Constitution: Before making changes, read the FairDM Constitution to understand the framework’s goals and constraints.