blender-id/README.md

3.8 KiB

Table of Contents

Blender ID

Blender ID is the unified login system for all services around Blender. With just one account you can set up a Blender Studio subscription or a Blender Development Fund membership, sign up for Blender Conference talks, manage your extensions at Blender Extensions Platform.

Development

Requirements

virtualenvwrapper adds commands for naming, creating, listing, activating and deactivating Python virtualenvs, which makes it much easier to work on various Python projects.

If you prefer not to use it, any other way of creating a virtualenv or venv will do.

Database setup

To create a new Blender ID database, run this as the PostgreSQL root user:

CREATE USER blender_id CREATEDB PASSWORD 'blender_id';
CREATE DATABASE blender_id OWNER blender_id;
CREATE SCHEMA blender_id;
GRANT ALL ON schema blender_id TO blender_id;

Password can be changed using the following:

ALTER ROLE blender_id WITH PASSWORD 'new_password';

In case of production, make sure that blender_id user has a good hard to guess password.

Development server setup

After cloning Blender ID repo, perform these steps to create a working dev server:

  • Copy development .env: cp .env.example .env;
  • Run git submodule update --init --recursive;
  • Create a virtual environment with Python 3.10:
    mkvirtualenv blender-id -a `pwd` -p /usr/bin/python3.10
    pip install -r requirements_dev.txt

Note that path to python3.10 binary might differ in your OS, adjust the mkvirtualenv command accordingly.

From this point on we assume you run everything with the virtual environment active.

  • Run ./manage.py migrate to migrate your database to the latest version;
  • Run ./manage.py createsuperuser to create super user;
  • Load fixtures:
   ./manage.py loaddata default_site
   ./manage.py loaddata default_roles
   ./manage.py loaddata flatpages
  • Run ./manage.py collectmedia to collect media from fixtures and place into the media directory;
  • Add 127.0.0.1 id.local to /etc/hosts;
  • Run DEBUG=True ./manage.py runserver

Development server is now available at http://id.local:8000/

Deploy

See playbooks.

Project layout and modules

├── assets_shared           # Blender Web Assets submodule: CSS, JS, etc. reused in Blender web-projects.
├── bid_addon_support       # Django app for the Blender ID add-on API (see below).
├── bid_api                 # Django app for APIs that are neither OAuth2 nor Blender ID add-on support
├── bid_main                # Main Django app, taking care of the web interface and OAuth2 authentication.
│   └── static              # Blender ID-specific asset sources (CSS, JS, etc.).
├── blenderid               # Django project, includes all the settings and top-level URL config.
│   └── .env.example        # Example development settings
└── playbooks               # Deployment playbooks and inventory
    └── shared              # Playbooks submodule reused in Blender web-projects.

OAuth

See OAuth.md.

Account deletion

See user_deletion.md.

Troubleshooting

"Site matching query does not exist."

Do this, activate Blender ID virtualenv environment and run:

./manage.py loaddata default_site

Then access your site at http://id.local:8000/. Add an entry to your hosts file if necessary.