Blender development fund website. https://fund.blender.org
Go to file
Oleg Komarov 705eb6e1a7 Admin: Implement option to set nofollow per membership credit #96844 2024-05-03 18:14:31 +02:00
GeoLite2-Country_20181002 Set default currency based on GeoIP database 2018-10-09 12:30:26 +02:00
assets_shared@8839ec4de3 Bump web-assets submodule to bring in a JS fix 2023-11-28 15:07:33 +01:00
blender_fund Logging: set default level to warn 2024-04-15 14:18:15 +02:00
blender_fund_main Admin: Implement option to set nofollow per membership credit #96844 2024-05-03 18:14:31 +02:00
blender_notes Remove gulp and pug D10407 2021-02-15 12:42:44 +01:00
campaign/simulator Campaign: revive code to make dummy gifts data for development 2023-12-31 13:23:31 +01:00
docs Automate Customer creation 2018-07-28 15:33:15 +02:00
donation-box@398d77d64b Version: Bump donation box to v1.0.12 2024-04-29 15:53:03 +02:00
logentry_admin Breaking changes: account-less checkout 2023-10-26 16:07:53 +02:00
playbooks Playbooks: simplify production push command 2024-01-11 17:17:10 +01:00
templates Admin: Implement option to set nofollow per membership credit #96844 2024-05-03 18:14:31 +02:00
.coveragerc Tests: add coverage config 2023-11-23 11:44:28 +01:00
.gitignore Update .gitignore 2023-12-02 20:52:23 +01:00
.gitmodules Campaign: devfund-donation-box component included via collectstatic 2023-11-27 17:15:24 +01:00
LICENSE.txt Add GPL 3 license file 2019-11-05 11:20:51 +01:00
README.md Typo in the README 2024-01-18 16:30:52 +01:00
deploy.sh Deploy: Update deploy.sh to support staging 2024-01-25 15:42:07 +01:00
manage.py Refactor into an example app 2018-06-27 19:57:20 +02:00
poetry.lock Admin: attempt to fix the currency warning 2024-04-30 18:30:21 +02:00
pyproject.toml Admin: attempt to fix the currency warning 2024-04-30 18:30:21 +02:00
setup.cfg PEP: copy flake8 settings from Studio's config 2023-11-03 12:01:44 +01:00

README.md

Blender Development Fund

Requirements

Recommended for local development:

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.

Setting up

Make a copy of example settings first:

cp blender_fund/settings.example.py blender_fund/settings.py

Initialise the submodule included into this repo:

git submodule update --init

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

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

and change blender_fund to a random password that you also store in the settings.py file. Alternatively, change the password using:

ALTER ROLE blender_fund WITH PASSWORD 'new_password';

In case of production, omit CREATEDB and make sure that both postgres and blender_fund users have secure hard to guess passwords set.

While inside project's directory, run the following to install project dependencies. Note that path to python3.10 binary might differ in your OS, adjust the mkvirtualenv command accordingly:

mkvirtualenv fund -a `pwd` -p /usr/bin/python3.10
pip install poetry==1.4.2
poetry install
./manage.py migrate
./manage.py loaddata systemuser devfund default_site
./manage.py collectmedia --noinput
./manage.py runserver 8010
./manage.py createsuperuser

The last command creates an admin account that can be used to log in at http://fund.local:8010/admin/.

Working with virtualenvwrapper

In addition to mkvirtualenv mentioned above, the following commands are useful:

  • use workon fund to go to Fund's project directory and activate its virtualenv;
  • use deactivate to "exit" it;
  • use lsvirtualenv to list existing virtualenvs;
  • use rmvirtualenv fund to delete Fund's virtualenv.

CMS

We use Wagtail as CMS for providing access to dynamic content of the website, such as page titles, calls to action, or entire pages. The CMS is accessible at the /cms endpoint.

Note: we are currently using a development version of Wagtail, therefore we need to build the static assets for the package ourselves. Check the warning in the startup log for more info on how to do it.

Stripe integration

TODO improve this section.

Follow the official guide for setting up Stripe CLI: https://stripe.com/docs/development/quickstart

Webhook testing

Run a local listener that will make webhook requests to your development server:

stripe listen --forward-to fund.local:8010/webhooks/stripe/

Run background tasks that are created by the webhook code:

./manage.py process_tasks

Braintree integration and HTTPS

It seems even the Braintree sandbox assumes you're using an HTTPS website. The easiest way to set this up is to use stunnel to create a simple HTTPS wrapper around your devserver.

NOTE: to make Django aware of the fact that HTTPS is used, set the environment variable HTTPS=1 when running manage.py runserver.

You can now access https://fund.local:8443/ to reach your dev server via HTTPS.

Documentation

cd docs
poetry run mkdocs serve -a localhost:8080

Testing

Run poetry run py.test to run the unit tests.

By default we use the --reuse-db option to speed up subsequent test runs. However, this skips the database migrations; add --create-db on the CLI to recreate the test database and run all the migrations.

GeoIP

The GeoIP database was downloaded from GeoLite2-Country

Deployment

  • Merge the required commits from master into production branch
  • Run unittests
  • Push production to origin
  • Run cd playbooks; ./ansible.sh -i environment/production deploy.yaml