blender-id/README.md

108 lines
3.8 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
gitea: none
include_toc: true
---
# Blender ID
[Blender ID](https://id.blender.org/) 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
* Python 3.10
* [virtualenv](https://pypi.org/project/virtualenv/)
* [PostgreSQL](https://www.postgresql.org/download/)
* [virtualenvwrapper](https://pypi.org/project/virtualenvwrapper/) (optional, but recommended)
`virtualenvwrapper` adds commands for naming, creating, listing, activating and deactivating
Python `virtualenv`s, 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](https://docs.python.org/3.10/library/venv.html) 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/](http://id.local:8000/)
# Deploy
See [playbooks](playbooks#deploy).
# 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](docs/OAuth.md).
# Account deletion
See [user_deletion.md](docs/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/](http://id.local:8000/). Add an entry to your hosts file if necessary.