aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-05-13 17:26:25 +0100
committerMatthew Lemon <y@yulqen.org>2024-05-13 17:26:25 +0100
commitefbbd480ddc62e695123d31c31d233b0df5155bd (patch)
treebc2fb465edd5050d83c97f280b1aac8e023fe3e5
After first pre-commit processing
Diffstat (limited to '')
-rw-r--r--.devcontainer/bashrc.override.sh20
-rw-r--r--.devcontainer/devcontainer.json36
-rw-r--r--.dockerignore12
-rw-r--r--.editorconfig27
-rw-r--r--.envs/.local/.django14
-rw-r--r--.envs/.local/.postgres7
-rw-r--r--.gitattributes1
-rw-r--r--.gitignore335
-rw-r--r--.gitlab-ci.yml39
-rw-r--r--.pre-commit-config.yaml49
-rw-r--r--.readthedocs.yml20
-rw-r--r--CONTRIBUTORS.txt1
-rw-r--r--COPYING674
-rw-r--r--LICENSE15
-rw-r--r--README.md97
-rw-r--r--compose/local/django/Dockerfile91
-rw-r--r--compose/local/django/celery/beat/start8
-rw-r--r--compose/local/django/celery/flower/start8
-rw-r--r--compose/local/django/celery/worker/start7
-rw-r--r--compose/local/django/start9
-rw-r--r--compose/local/docs/Dockerfile62
-rw-r--r--compose/local/docs/start7
-rw-r--r--compose/production/aws/Dockerfile9
-rw-r--r--compose/production/aws/maintenance/download23
-rw-r--r--compose/production/aws/maintenance/upload29
-rw-r--r--compose/production/django/Dockerfile96
-rw-r--r--compose/production/django/celery/beat/start8
-rw-r--r--compose/production/django/celery/flower/start11
-rw-r--r--compose/production/django/celery/worker/start8
-rw-r--r--compose/production/django/entrypoint49
-rw-r--r--compose/production/django/start10
-rw-r--r--compose/production/nginx/Dockerfile2
-rw-r--r--compose/production/nginx/default.conf7
-rw-r--r--compose/production/postgres/Dockerfile6
-rw-r--r--compose/production/postgres/maintenance/_sourced/constants.sh5
-rw-r--r--compose/production/postgres/maintenance/_sourced/countdown.sh12
-rw-r--r--compose/production/postgres/maintenance/_sourced/messages.sh41
-rw-r--r--compose/production/postgres/maintenance/_sourced/yes_no.sh16
-rw-r--r--compose/production/postgres/maintenance/backup38
-rw-r--r--compose/production/postgres/maintenance/backups22
-rw-r--r--compose/production/postgres/maintenance/restore55
-rw-r--r--compose/production/postgres/maintenance/rmbackup36
-rw-r--r--compose/production/traefik/Dockerfile5
-rw-r--r--compose/production/traefik/traefik.yml75
-rw-r--r--config/__init__.py5
-rw-r--r--config/celery_app.py17
-rw-r--r--config/settings/__init__.py0
-rw-r--r--config/settings/base.py319
-rw-r--r--config/settings/local.py71
-rw-r--r--config/settings/production.py207
-rw-r--r--config/settings/test.py38
-rw-r--r--config/urls.py53
-rw-r--r--config/wsgi.py40
-rw-r--r--docs.yml18
-rw-r--r--docs/Makefile29
-rw-r--r--docs/__init__.py1
-rw-r--r--docs/conf.py64
-rw-r--r--docs/howto.rst38
-rw-r--r--docs/index.rst24
-rw-r--r--docs/make.bat46
-rw-r--r--docs/pycharm/configuration.rst70
-rw-r--r--docs/pycharm/images/1.pngbin0 -> 67153 bytes
-rw-r--r--docs/pycharm/images/2.pngbin0 -> 15163 bytes
-rw-r--r--docs/pycharm/images/3.pngbin0 -> 181106 bytes
-rw-r--r--docs/pycharm/images/4.pngbin0 -> 113084 bytes
-rw-r--r--docs/pycharm/images/7.pngbin0 -> 6284 bytes
-rw-r--r--docs/pycharm/images/8.pngbin0 -> 19800 bytes
-rw-r--r--docs/pycharm/images/f1.pngbin0 -> 254645 bytes
-rw-r--r--docs/pycharm/images/f2.pngbin0 -> 234376 bytes
-rw-r--r--docs/pycharm/images/f3.pngbin0 -> 235846 bytes
-rw-r--r--docs/pycharm/images/f4.pngbin0 -> 226939 bytes
-rw-r--r--docs/pycharm/images/issue1.pngbin0 -> 43350 bytes
-rw-r--r--docs/pycharm/images/issue2.pngbin0 -> 11625 bytes
-rw-r--r--docs/users.rst15
-rw-r--r--local.yml75
-rw-r--r--locale/README.md32
-rw-r--r--locale/en_US/LC_MESSAGES/django.po12
-rw-r--r--locale/fr_FR/LC_MESSAGES/django.po335
-rw-r--r--locale/pt_BR/LC_MESSAGES/django.po315
-rwxr-xr-xmanage.py32
-rw-r--r--merge_production_dotenvs_in_dotenv.py27
-rw-r--r--production.yml73
-rw-r--r--pyblackbird_cc/__init__.py5
-rw-r--r--pyblackbird_cc/conftest.py14
-rw-r--r--pyblackbird_cc/contrib/__init__.py5
-rw-r--r--pyblackbird_cc/contrib/sites/__init__.py5
-rw-r--r--pyblackbird_cc/contrib/sites/migrations/0001_initial.py43
-rw-r--r--pyblackbird_cc/contrib/sites/migrations/0002_alter_domain_unique.py21
-rw-r--r--pyblackbird_cc/contrib/sites/migrations/0003_set_site_domain_and_name.py63
-rw-r--r--pyblackbird_cc/contrib/sites/migrations/0004_alter_options_ordering_domain.py21
-rw-r--r--pyblackbird_cc/contrib/sites/migrations/__init__.py5
-rw-r--r--pyblackbird_cc/resources/__init__.py0
-rw-r--r--pyblackbird_cc/resources/admin.py1
-rw-r--r--pyblackbird_cc/resources/apps.py6
-rw-r--r--pyblackbird_cc/resources/migrations/__init__.py0
-rw-r--r--pyblackbird_cc/resources/models.py1
-rw-r--r--pyblackbird_cc/resources/tests.py1
-rw-r--r--pyblackbird_cc/resources/views.py1
-rw-r--r--pyblackbird_cc/static/css/project.css13
-rw-r--r--pyblackbird_cc/static/css/wrapper.css492
-rw-r--r--pyblackbird_cc/static/fonts/.gitkeep0
-rw-r--r--pyblackbird_cc/static/fonts/LibreFranklin-Italic.ttfbin0 -> 69376 bytes
-rw-r--r--pyblackbird_cc/static/fonts/LibreFranklin-VariableFont_wght.ttfbin0 -> 103512 bytes
-rw-r--r--pyblackbird_cc/static/images/favicons/favicon.icobin0 -> 8348 bytes
-rw-r--r--pyblackbird_cc/static/js/project.js1
-rw-r--r--pyblackbird_cc/templates/403.html15
-rw-r--r--pyblackbird_cc/templates/403_csrf.html15
-rw-r--r--pyblackbird_cc/templates/404.html15
-rw-r--r--pyblackbird_cc/templates/500.html12
-rw-r--r--pyblackbird_cc/templates/account/base_manage_password.html10
-rw-r--r--pyblackbird_cc/templates/allauth/elements/alert.html7
-rw-r--r--pyblackbird_cc/templates/allauth/elements/badge.html6
-rw-r--r--pyblackbird_cc/templates/allauth/elements/button.html20
-rw-r--r--pyblackbird_cc/templates/allauth/elements/field.html66
-rw-r--r--pyblackbird_cc/templates/allauth/elements/fields.html3
-rw-r--r--pyblackbird_cc/templates/allauth/elements/panel.html19
-rw-r--r--pyblackbird_cc/templates/allauth/elements/table.html6
-rw-r--r--pyblackbird_cc/templates/allauth/layouts/entrance.html34
-rw-r--r--pyblackbird_cc/templates/allauth/layouts/manage.html6
-rw-r--r--pyblackbird_cc/templates/base.html127
-rw-r--r--pyblackbird_cc/templates/pages/about.html1
-rw-r--r--pyblackbird_cc/templates/pages/home.html1
-rw-r--r--pyblackbird_cc/templates/users/user_detail.html31
-rw-r--r--pyblackbird_cc/templates/users/user_form.html21
-rw-r--r--pyblackbird_cc/users/__init__.py0
-rw-r--r--pyblackbird_cc/users/adapters.py48
-rw-r--r--pyblackbird_cc/users/admin.py49
-rw-r--r--pyblackbird_cc/users/apps.py13
-rw-r--r--pyblackbird_cc/users/context_processors.py8
-rw-r--r--pyblackbird_cc/users/forms.py44
-rw-r--r--pyblackbird_cc/users/managers.py42
-rw-r--r--pyblackbird_cc/users/migrations/0001_initial.py112
-rw-r--r--pyblackbird_cc/users/migrations/__init__.py0
-rw-r--r--pyblackbird_cc/users/models.py38
-rw-r--r--pyblackbird_cc/users/tasks.py9
-rw-r--r--pyblackbird_cc/users/tests/__init__.py0
-rw-r--r--pyblackbird_cc/users/tests/factories.py40
-rw-r--r--pyblackbird_cc/users/tests/test_admin.py65
-rw-r--r--pyblackbird_cc/users/tests/test_forms.py35
-rw-r--r--pyblackbird_cc/users/tests/test_managers.py55
-rw-r--r--pyblackbird_cc/users/tests/test_models.py5
-rw-r--r--pyblackbird_cc/users/tests/test_tasks.py17
-rw-r--r--pyblackbird_cc/users/tests/test_urls.py19
-rw-r--r--pyblackbird_cc/users/tests/test_views.py101
-rw-r--r--pyblackbird_cc/users/urls.py12
-rw-r--r--pyblackbird_cc/users/views.py45
-rw-r--r--pyproject.toml171
-rw-r--r--requirements/base.txt19
-rw-r--r--requirements/local.txt34
-rw-r--r--requirements/production.txt12
-rw-r--r--tests/__init__.py0
-rw-r--r--tests/test_merge_production_dotenvs_in_dotenv.py34
152 files changed, 6198 insertions, 0 deletions
diff --git a/.devcontainer/bashrc.override.sh b/.devcontainer/bashrc.override.sh
new file mode 100644
index 0000000..bedddf6
--- /dev/null
+++ b/.devcontainer/bashrc.override.sh
@@ -0,0 +1,20 @@
+
+#
+# .bashrc.override.sh
+#
+
+# persistent bash history
+HISTFILE=~/.bash_history
+PROMPT_COMMAND="history -a; $PROMPT_COMMAND"
+
+# set some django env vars
+source /entrypoint
+
+# restore default shell options
+set +o errexit
+set +o pipefail
+set +o nounset
+
+# start ssh-agent
+# https://code.visualstudio.com/docs/remote/troubleshooting
+eval "$(ssh-agent -s)"
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
new file mode 100644
index 0000000..b78092f
--- /dev/null
+++ b/.devcontainer/devcontainer.json
@@ -0,0 +1,36 @@
+// For format details, see https://containers.dev/implementors/json_reference/
+{
+ "name": "pyblackbird_cc_dev",
+ "dockerComposeFile": [
+ "../local.yml"
+ ],
+ "init": true,
+ "mounts": [
+ {
+ "source": "./.devcontainer/bash_history",
+ "target": "/home/dev-user/.bash_history",
+ "type": "bind"
+ },
+ {
+ "source": "~/.ssh",
+ "target": "/home/dev-user/.ssh",
+ "type": "bind"
+ }
+ ],
+ // Tells devcontainer.json supporting services / tools whether they should run
+ // /bin/sh -c "while sleep 1000; do :; done" when starting the container instead of the container’s default command
+ "overrideCommand": false,
+ "service": "django",
+ // "remoteEnv": {"PATH": "/home/dev-user/.local/bin:${containerEnv:PATH}"},
+ "remoteUser": "dev-user",
+ "workspaceFolder": "/app",
+ // Set *default* container specific settings.json values on container create.
+ "customizations": {
+ },
+ // Uncomment the next line if you want start specific services in your Docker Compose config.
+ // "runServices": [],
+ // Uncomment the next line if you want to keep your containers running after VS Code shuts down.
+ // "shutdownAction": "none",
+ // Uncomment the next line to run commands after the container is created.
+ "postCreateCommand": "cat .devcontainer/bashrc.override.sh >> ~/.bashrc"
+}
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..a602416
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,12 @@
+.editorconfig
+.gitattributes
+.github
+.gitignore
+.gitlab-ci.yml
+.idea
+.pre-commit-config.yaml
+.readthedocs.yml
+.travis.yml
+venv
+.git
+.envs/
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..c0ce342
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,27 @@
+# http://editorconfig.org
+
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.{py,rst,ini}]
+indent_style = space
+indent_size = 4
+
+[*.{html,css,scss,json,yml,xml}]
+indent_style = space
+indent_size = 2
+
+[*.md]
+trim_trailing_whitespace = false
+
+[Makefile]
+indent_style = tab
+
+[default.conf]
+indent_style = space
+indent_size = 2
diff --git a/.envs/.local/.django b/.envs/.local/.django
new file mode 100644
index 0000000..e20db73
--- /dev/null
+++ b/.envs/.local/.django
@@ -0,0 +1,14 @@
+# General
+# ------------------------------------------------------------------------------
+USE_DOCKER=yes
+IPYTHONDIR=/app/.ipython
+# Redis
+# ------------------------------------------------------------------------------
+REDIS_URL=redis://redis:6379/0
+
+# Celery
+# ------------------------------------------------------------------------------
+
+# Flower
+CELERY_FLOWER_USER=GtKEXvuJJrEWITDgEQboQqwlxYBwjUfa
+CELERY_FLOWER_PASSWORD=Scv4VgYqnUjkkaS2bP4rk6Txn3eFqTYuuXRQRMLCO14BSehv7tzaGgYlPLxRcsyE
diff --git a/.envs/.local/.postgres b/.envs/.local/.postgres
new file mode 100644
index 0000000..302197d
--- /dev/null
+++ b/.envs/.local/.postgres
@@ -0,0 +1,7 @@
+# PostgreSQL
+# ------------------------------------------------------------------------------
+POSTGRES_HOST=postgres
+POSTGRES_PORT=5432
+POSTGRES_DB=pyblackbird_cc
+POSTGRES_USER=TyGbwdJQNsWKWloWSdhHyTmXiKrvZeij
+POSTGRES_PASSWORD=p9yz0UNLt1YzhvfZFl24vwOeTvmmfyfrUyFuEjqRa2QlHQaR0OixvDORr04MIrjz
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..176a458
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+* text=auto
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..86f4126
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,335 @@
+### Python template
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+*$py.class
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+.eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+wheels/
+*.egg-info/
+.installed.cfg
+*.egg
+
+# PyInstaller
+# Usually these files are written by a python script from a template
+# before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.coverage
+.coverage.*
+.cache
+nosetests.xml
+coverage.xml
+*.cover
+.hypothesis/
+
+# Translations
+*.mo
+*.pot
+
+# Django stuff:
+staticfiles/
+
+# Sphinx documentation
+docs/_build/
+
+# PyBuilder
+target/
+
+# pyenv
+.python-version
+
+# celery beat schedule file
+celerybeat-schedule
+
+# Environments
+.venv
+venv/
+ENV/
+
+# Rope project settings
+.ropeproject
+
+# mkdocs documentation
+/site
+
+# mypy
+.mypy_cache/
+
+
+### Node template
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+
+# Runtime data
+pids
+*.pid
+*.seed
+*.pid.lock
+
+# Directory for instrumented libs generated by jscoverage/JSCover
+lib-cov
+
+# Coverage directory used by tools like istanbul
+coverage
+
+# nyc test coverage
+.nyc_output
+
+# Bower dependency directory (https://bower.io/)
+bower_components
+
+# node-waf configuration
+.lock-wscript
+
+# Compiled binary addons (http://nodejs.org/api/addons.html)
+build/Release
+
+# Dependency directories
+node_modules/
+jspm_packages/
+
+# Typescript v1 declaration files
+typings/
+
+# Optional npm cache directory
+.npm
+
+# Optional eslint cache
+.eslintcache
+
+# Optional REPL history
+.node_repl_history
+
+# Output of 'npm pack'
+*.tgz
+
+# Yarn Integrity file
+.yarn-integrity
+
+
+### Linux template
+*~
+
+# temporary files which can be created if a process still has a handle open of a deleted file
+.fuse_hidden*
+
+# KDE directory preferences
+.directory
+
+# Linux trash folder which might appear on any partition or disk
+.Trash-*
+
+# .nfs files are created when an open file is removed but is still being accessed
+.nfs*
+
+
+### VisualStudioCode template
+.vscode/*
+!.vscode/settings.json
+!.vscode/tasks.json
+!.vscode/launch.json
+!.vscode/extensions.json
+*.code-workspace
+
+# Local History for devcontainer
+.devcontainer/bash_history
+
+# Provided default Pycharm Run/Debug Configurations should be tracked by git
+# In case of local modifications made by Pycharm, use update-index command
+# for each changed file, like this:
+# git update-index --assume-unchanged .idea/pyblackbird_cc.iml
+### JetBrains template
+# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
+# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
+
+# User-specific stuff:
+.idea/**/workspace.xml
+.idea/**/tasks.xml
+.idea/dictionaries
+
+# Sensitive or high-churn files:
+.idea/**/dataSources/
+.idea/**/dataSources.ids
+.idea/**/dataSources.xml
+.idea/**/dataSources.local.xml
+.idea/**/sqlDataSources.xml
+.idea/**/dynamic.xml
+.idea/**/uiDesigner.xml
+
+# Gradle:
+.idea/**/gradle.xml
+.idea/**/libraries
+
+# CMake
+cmake-build-debug/
+
+# Mongo Explorer plugin:
+.idea/**/mongoSettings.xml
+
+## File-based project format:
+*.iws
+
+## Plugin-specific files:
+
+# IntelliJ
+out/
+
+# mpeltonen/sbt-idea plugin
+.idea_modules/
+
+# JIRA plugin
+atlassian-ide-plugin.xml
+
+# Cursive Clojure plugin
+.idea/replstate.xml
+
+# Crashlytics plugin (for Android Studio and IntelliJ)
+com_crashlytics_export_strings.xml
+crashlytics.properties
+crashlytics-build.properties
+fabric.properties
+
+
+
+### Windows template
+# Windows thumbnail cache files
+Thumbs.db
+ehthumbs.db
+ehthumbs_vista.db
+
+# Dump file
+*.stackdump
+
+# Folder config file
+Desktop.ini
+
+# Recycle Bin used on file shares
+$RECYCLE.BIN/
+
+# Windows Installer files
+*.cab
+*.msi
+*.msm
+*.msp
+
+# Windows shortcuts
+*.lnk
+
+
+### macOS template
+# General
+*.DS_Store
+.AppleDouble
+.LSOverride
+
+# Icon must end with two \r
+Icon
+
+# Thumbnails
+._*
+
+# Files that might appear in the root of a volume
+.DocumentRevisions-V100
+.fseventsd
+.Spotlight-V100
+.TemporaryItems
+.Trashes
+.VolumeIcon.icns
+.com.apple.timemachine.donotpresent
+
+# Directories potentially created on remote AFP share
+.AppleDB
+.AppleDesktop
+Network Trash Folder
+Temporary Items
+.apdisk
+
+
+### SublimeText template
+# Cache files for Sublime Text
+*.tmlanguage.cache
+*.tmPreferences.cache
+*.stTheme.cache
+
+# Workspace files are user-specific
+*.sublime-workspace
+
+# Project files should be checked into the repository, unless a significant
+# proportion of contributors will probably not be using Sublime Text
+# *.sublime-project
+
+# SFTP configuration file
+sftp-config.json
+
+# Package control specific files
+Package Control.last-run
+Package Control.ca-list
+Package Control.ca-bundle
+Package Control.system-ca-bundle
+Package Control.cache/
+Package Control.ca-certs/
+Package Control.merged-ca-bundle
+Package Control.user-ca-bundle
+oscrypto-ca-bundle.crt
+bh_unicode_properties.cache
+
+# Sublime-github package stores a github token in this file
+# https://packagecontrol.io/packages/sublime-github
+GitHub.sublime-settings
+
+
+### Vim template
+# Swap
+[._]*.s[a-v][a-z]
+[._]*.sw[a-p]
+[._]s[a-v][a-z]
+[._]sw[a-p]
+
+# Session
+Session.vim
+
+# Temporary
+.netrwhist
+
+# Auto-generated tag files
+tags
+
+# Redis dump file
+dump.rdb
+
+### Project template
+pyblackbird_cc/media/
+
+.pytest_cache/
+.ipython/
+.env
+.envs/*
+!.envs/.local/
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..5e32d2a
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,39 @@
+stages:
+ - lint
+ - test
+
+variables:
+ POSTGRES_USER: 'pyblackbird_cc'
+ POSTGRES_PASSWORD: ''
+ POSTGRES_DB: 'test_pyblackbird_cc'
+ POSTGRES_HOST_AUTH_METHOD: trust
+ CELERY_BROKER_URL: 'redis://redis:6379/0'
+
+precommit:
+ stage: lint
+ image: python:3.12
+ variables:
+ PRE_COMMIT_HOME: ${CI_PROJECT_DIR}/.cache/pre-commit
+ cache:
+ paths:
+ - ${PRE_COMMIT_HOME}
+ before_script:
+ - pip install -q pre-commit
+ script:
+ - pre-commit run --show-diff-on-failure --color=always --all-files
+
+pytest:
+ stage: test
+ image: docker:25.0
+ tags:
+ - docker
+ services:
+ - docker:dind
+ before_script:
+ - docker compose -f local.yml build
+ - docker compose -f docs.yml build
+ # Ensure celerybeat does not crash due to non-existent tables
+ - docker compose -f local.yml run --rm django python manage.py migrate
+ - docker compose -f local.yml up -d
+ script:
+ - docker compose -f local.yml run django pytest
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..cb75719
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,49 @@
+exclude: '^docs/|/migrations/|devcontainer.json'
+default_stages: [commit]
+
+default_language_version:
+ python: python3.11
+
+repos:
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v4.6.0
+ hooks:
+ - id: trailing-whitespace
+ - id: end-of-file-fixer
+ - id: check-json
+ - id: check-toml
+ - id: check-xml
+ - id: check-yaml
+ - id: debug-statements
+ - id: check-builtin-literals
+ - id: check-case-conflict
+ - id: check-docstring-first
+ - id: detect-private-key
+
+ - repo: https://github.com/adamchainz/django-upgrade
+ rev: '1.17.0'
+ hooks:
+ - id: django-upgrade
+ args: ['--target-version', '4.2']
+
+ # Run the Ruff linter.
+ - repo: https://github.com/astral-sh/ruff-pre-commit
+ rev: v0.4.4
+ hooks:
+ # Linter
+ - id: ruff
+ args: [--fix, --exit-non-zero-on-fix]
+ # Formatter
+ - id: ruff-format
+
+ - repo: https://github.com/Riverside-Healthcare/djLint
+ rev: v1.34.1
+ hooks:
+ - id: djlint-reformat-django
+ - id: djlint-django
+
+# sets up .pre-commit-ci.yaml to ensure pre-commit dependencies stay up to date
+ci:
+ autoupdate_schedule: weekly
+ skip: []
+ submodules: false
diff --git a/.readthedocs.yml b/.readthedocs.yml
new file mode 100644
index 0000000..5564388
--- /dev/null
+++ b/.readthedocs.yml
@@ -0,0 +1,20 @@
+# Read the Docs configuration file
+# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
+
+# Required
+version: 2
+
+# Set the version of Python and other tools you might need
+build:
+ os: ubuntu-22.04
+ tools:
+ python: '3.12'
+
+# Build documentation in the docs/ directory with Sphinx
+sphinx:
+ configuration: docs/conf.py
+
+# Python requirements required to build your docs
+python:
+ install:
+ - requirements: requirements/local.txt
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
new file mode 100644
index 0000000..9861cf4
--- /dev/null
+++ b/CONTRIBUTORS.txt
@@ -0,0 +1 @@
+Matthew Lemon
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..94a9ed0
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..96aa337
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,15 @@
+
+Copyright (c) 2024, Matthew Lemon
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..a510637
--- /dev/null
+++ b/README.md
@@ -0,0 +1,97 @@
+# pyblackbird-cc
+
+Joanna Lemon Resources
+
+[![Built with Cookiecutter Django](https://img.shields.io/badge/built%20with-Cookiecutter%20Django-ff69b4.svg?logo=cookiecutter)](https://github.com/cookiecutter/cookiecutter-django/)
+[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
+
+License: GPLv3
+
+## Settings
+
+Moved to [settings](http://cookiecutter-django.readthedocs.io/en/latest/settings.html).
+
+## Basic Commands
+
+### Setting Up Your Users
+
+- To create a **normal user account**, just go to Sign Up and fill out the form. Once you submit it, you'll see a "Verify Your E-mail Address" page. Go to your console to see a simulated email verification message. Copy the link into your browser. Now the user's email should be verified and ready to go.
+
+- To create a **superuser account**, use this command:
+
+ $ python manage.py createsuperuser
+
+For convenience, you can keep your normal user logged in on Chrome and your superuser logged in on Firefox (or similar), so that you can see how the site behaves for both kinds of users.
+
+### Type checks
+
+Running type checks with mypy:
+
+ $ mypy pyblackbird_cc
+
+### Test coverage
+
+To run the tests, check your test coverage, and generate an HTML coverage report:
+
+ $ coverage run -m pytest
+ $ coverage html
+ $ open htmlcov/index.html
+
+#### Running tests with pytest
+
+ $ pytest
+
+### Live reloading and Sass CSS compilation
+
+Moved to [Live reloading and SASS compilation](https://cookiecutter-django.readthedocs.io/en/latest/developing-locally.html#sass-compilation-live-reloading).
+
+### Celery
+
+This app comes with Celery.
+
+To run a celery worker:
+
+```bash
+cd pyblackbird_cc
+celery -A config.celery_app worker -l info
+```
+
+Please note: For Celery's import magic to work, it is important _where_ the celery commands are run. If you are in the same folder with _manage.py_, you should be right.
+
+To run [periodic tasks](https://docs.celeryq.dev/en/stable/userguide/periodic-tasks.html), you'll need to start the celery beat scheduler service. You can start it as a standalone process:
+
+```bash
+cd pyblackbird_cc
+celery -A config.celery_app beat
+```
+
+or you can embed the beat service inside a worker with the `-B` option (not recommended for production use):
+
+```bash
+cd pyblackbird_cc
+celery -A config.celery_app worker -B -l info
+```
+
+### Email Server
+
+In development, it is often nice to be able to see emails that are being sent from your application. For that reason local SMTP server [Mailpit](https://github.com/axllent/mailpit) with a web interface is available as docker container.
+
+Container mailpit will start automatically when you will run all docker containers.
+Please check [cookiecutter-django Docker documentation](http://cookiecutter-django.readthedocs.io/en/latest/deployment-with-docker.html) for more details how to start all containers.
+
+With Mailpit running, to view messages that are sent by your application, open your browser and go to `http://127.0.0.1:8025`
+
+### Sentry
+
+Sentry is an error logging aggregator service. You can sign up for a free account at <https://sentry.io/signup/?code=cookiecutter> or download and host it yourself.
+The system is set up with reasonable defaults, including 404 logging and integration with the WSGI application.
+
+You must set the DSN url in production.
+
+## Deployment
+
+The following details how to deploy this application.
+
+### Docker
+
+See detailed [cookiecutter-django Docker documentation](http://cookiecutter-django.readthedocs.io/en/latest/deployment-with-docker.html).
diff --git a/compose/local/django/Dockerfile b/compose/local/django/Dockerfile
new file mode 100644
index 0000000..5f5f4e5
--- /dev/null
+++ b/compose/local/django/Dockerfile
@@ -0,0 +1,91 @@
+# define an alias for the specific python version used in this file.
+FROM docker.io/python:3.12.3-slim-bookworm as python
+
+# Python build stage
+FROM python as python-build-stage
+
+ARG BUILD_ENVIRONMENT=local
+
+# Install apt packages
+RUN apt-get update && apt-get install --no-install-recommends -y \
+ # dependencies for building Python packages
+ build-essential \
+ # psycopg dependencies
+ libpq-dev
+
+# Requirements are installed here to ensure they will be cached.
+COPY ./requirements .
+
+# Create Python Dependency and Sub-Dependency Wheels.
+RUN pip wheel --wheel-dir /usr/src/app/wheels \
+ -r ${BUILD_ENVIRONMENT}.txt
+
+
+# Python 'run' stage
+FROM python as python-run-stage
+
+ARG BUILD_ENVIRONMENT=local
+ARG APP_HOME=/app
+
+ENV PYTHONUNBUFFERED 1
+ENV PYTHONDONTWRITEBYTECODE 1
+ENV BUILD_ENV ${BUILD_ENVIRONMENT}
+
+WORKDIR ${APP_HOME}
+
+
+# devcontainer dependencies and utils
+RUN apt-get update && apt-get install --no-install-recommends -y \
+ sudo git bash-completion nano ssh
+
+# Create devcontainer user and add it to sudoers
+RUN groupadd --gid 1000 dev-user \
+ && useradd --uid 1000 --gid dev-user --shell /bin/bash --create-home dev-user \
+ && echo dev-user ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/dev-user \
+ && chmod 0440 /etc/sudoers.d/dev-user
+
+
+# Install required system dependencies
+RUN apt-get update && apt-get install --no-install-recommends -y \
+ # psycopg dependencies
+ libpq-dev \
+ # Translations dependencies
+ gettext \
+ # cleaning up unused files
+ && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
+ && rm -rf /var/lib/apt/lists/*
+
+# All absolute dir copies ignore workdir instruction. All relative dir copies are wrt to the workdir instruction
+# copy python dependency wheels from python-build-stage
+COPY --from=python-build-stage /usr/src/app/wheels /wheels/
+
+# use wheels to install python dependencies
+RUN pip install --no-cache-dir --no-index --find-links=/wheels/ /wheels/* \
+ && rm -rf /wheels/
+
+COPY ./compose/production/django/entrypoint /entrypoint
+RUN sed -i 's/\r$//g' /entrypoint
+RUN chmod +x /entrypoint
+
+COPY ./compose/local/django/start /start
+RUN sed -i 's/\r$//g' /start
+RUN chmod +x /start
+
+
+COPY ./compose/local/django/celery/worker/start /start-celeryworker
+RUN sed -i 's/\r$//g' /start-celeryworker
+RUN chmod +x /start-celeryworker
+
+COPY ./compose/local/django/celery/beat/start /start-celerybeat
+RUN sed -i 's/\r$//g' /start-celerybeat
+RUN chmod +x /start-celerybeat
+
+COPY ./compose/local/django/celery/flower/start /start-flower
+RUN sed -i 's/\r$//g' /start-flower
+RUN chmod +x /start-flower
+
+
+# copy application code to WORKDIR
+COPY . ${APP_HOME}
+
+ENTRYPOINT ["/entrypoint"]
diff --git a/compose/local/django/celery/beat/start b/compose/local/django/celery/beat/start
new file mode 100644
index 0000000..8adc489
--- /dev/null
+++ b/compose/local/django/celery/beat/start
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+set -o errexit
+set -o nounset
+
+
+rm -f './celerybeat.pid'
+exec watchfiles --filter python celery.__main__.main --args '-A config.celery_app beat -l INFO'
diff --git a/compose/local/django/celery/flower/start b/compose/local/django/celery/flower/start
new file mode 100644
index 0000000..b4783d2
--- /dev/null
+++ b/compose/local/django/celery/flower/start
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+set -o errexit
+set -o nounset
+
+exec watchfiles --filter python celery.__main__.main \
+ --args \
+ "-A config.celery_app -b \"${CELERY_BROKER_URL}\" flower --basic_auth=\"${CELERY_FLOWER_USER}:${CELERY_FLOWER_PASSWORD}\""
diff --git a/compose/local/django/celery/worker/start b/compose/local/django/celery/worker/start
new file mode 100644
index 0000000..183a801
--- /dev/null
+++ b/compose/local/django/celery/worker/start
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+set -o errexit
+set -o nounset
+
+
+exec watchfiles --filter python celery.__main__.main --args '-A config.celery_app worker -l INFO'
diff --git a/compose/local/django/start b/compose/local/django/start
new file mode 100644
index 0000000..ba96db4
--- /dev/null
+++ b/compose/local/django/start
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+set -o errexit
+set -o pipefail
+set -o nounset
+
+
+python manage.py migrate
+exec python manage.py runserver_plus 0.0.0.0:8000
diff --git a/compose/local/docs/Dockerfile b/compose/local/docs/Dockerfile
new file mode 100644
index 0000000..3556504
--- /dev/null
+++ b/compose/local/docs/Dockerfile
@@ -0,0 +1,62 @@
+# define an alias for the specific python version used in this file.
+FROM docker.io/python:3.12.3-slim-bookworm as python
+
+
+# Python build stage
+FROM python as python-build-stage
+
+ENV PYTHONDONTWRITEBYTECODE 1
+
+RUN apt-get update && apt-get install --no-install-recommends -y \
+ # dependencies for building Python packages
+ build-essential \
+ # psycopg dependencies
+ libpq-dev \
+ # cleaning up unused files
+ && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
+ && rm -rf /var/lib/apt/lists/*
+
+# Requirements are installed here to ensure they will be cached.
+COPY ./requirements /requirements
+
+# create python dependency wheels
+RUN pip wheel --no-cache-dir --wheel-dir /usr/src/app/wheels \
+ -r /requirements/local.txt -r /requirements/production.txt \
+ && rm -rf /requirements
+
+
+# Python 'run' stage
+FROM python as python-run-stage
+
+ARG BUILD_ENVIRONMENT
+ENV PYTHONUNBUFFERED 1
+ENV PYTHONDONTWRITEBYTECODE 1
+
+RUN apt-get update && apt-get install --no-install-recommends -y \
+ # To run the Makefile
+ make \
+ # psycopg dependencies
+ libpq-dev \
+ # Translations dependencies
+ gettext \
+ # Uncomment below lines to enable Sphinx output to latex and pdf
+ # texlive-latex-recommended \
+ # texlive-fonts-recommended \
+ # texlive-latex-extra \
+ # latexmk \
+ # cleaning up unused files
+ && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
+ && rm -rf /var/lib/apt/lists/*
+
+# copy python dependency wheels from python-build-stage
+COPY --from=python-build-stage /usr/src/app/wheels /wheels
+
+# use wheels to install python dependencies
+RUN pip install --no-cache /wheels/* \
+ && rm -rf /wheels
+
+COPY ./compose/local/docs/start /start-docs
+RUN sed -i 's/\r$//g' /start-docs
+RUN chmod +x /start-docs
+
+WORKDIR /docs
diff --git a/compose/local/docs/start b/compose/local/docs/start
new file mode 100644
index 0000000..96a94f5
--- /dev/null
+++ b/compose/local/docs/start
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+set -o errexit
+set -o pipefail
+set -o nounset
+
+exec make livehtml
diff --git a/compose/production/aws/Dockerfile b/compose/production/aws/Dockerfile
new file mode 100644
index 0000000..36eea7f
--- /dev/null
+++ b/compose/production/aws/Dockerfile
@@ -0,0 +1,9 @@
+FROM docker.io/garland/aws-cli-docker:1.16.140
+
+COPY ./compose/production/aws/maintenance /usr/local/bin/maintenance
+COPY ./compose/production/postgres/maintenance/_sourced /usr/local/bin/maintenance/_sourced
+
+RUN chmod +x /usr/local/bin/maintenance/*
+
+RUN mv /usr/local/bin/maintenance/* /usr/local/bin \
+ && rmdir /usr/local/bin/maintenance
diff --git a/compose/production/aws/maintenance/download b/compose/production/aws/maintenance/download
new file mode 100644
index 0000000..9561d91
--- /dev/null
+++ b/compose/production/aws/maintenance/download
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+### Download a file from your Amazon S3 bucket to the postgres /backups folder
+###
+### Usage:
+### $ docker compose -f production.yml run --rm awscli <1>
+
+set -o errexit
+set -o pipefail
+set -o nounset
+
+working_dir="$(dirname ${0})"
+source "${working_dir}/_sourced/constants.sh"
+source "${working_dir}/_sourced/messages.sh"
+
+export AWS_ACCESS_KEY_ID="${DJANGO_AWS_ACCESS_KEY_ID}"
+export AWS_SECRET_ACCESS_KEY="${DJANGO_AWS_SECRET_ACCESS_KEY}"
+export AWS_STORAGE_BUCKET_NAME="${DJANGO_AWS_STORAGE_BUCKET_NAME}"
+
+
+aws s3 cp s3://${AWS_STORAGE_BUCKET_NAME}${BACKUP_DIR_PATH}/${1} ${BACKUP_DIR_PATH}/${1}
+
+message_success "Finished downloading ${1}."
diff --git a/compose/production/aws/maintenance/upload b/compose/production/aws/maintenance/upload
new file mode 100644
index 0000000..73c1b9b
--- /dev/null
+++ b/compose/production/aws/maintenance/upload
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+### Upload the /backups folder to Amazon S3
+###
+### Usage:
+### $ docker compose -f production.yml run --rm awscli upload
+
+set -o errexit
+set -o pipefail
+set -o nounset
+
+working_dir="$(dirname ${0})"
+source "${working_dir}/_sourced/constants.sh"
+source "${working_dir}/_sourced/messages.sh"
+
+export AWS_ACCESS_KEY_ID="${DJANGO_AWS_ACCESS_KEY_ID}"
+export AWS_SECRET_ACCESS_KEY="${DJANGO_AWS_SECRET_ACCESS_KEY}"
+export AWS_STORAGE_BUCKET_NAME="${DJANGO_AWS_STORAGE_BUCKET_NAME}"
+
+
+message_info "Upload the backups directory to S3 bucket {$AWS_STORAGE_BUCKET_NAME}"
+
+aws s3 cp ${BACKUP_DIR_PATH} s3://${AWS_STORAGE_BUCKET_NAME}${BACKUP_DIR_PATH} --recursive
+
+message_info "Cleaning the directory ${BACKUP_DIR_PATH}"
+
+rm -rf ${BACKUP_DIR_PATH}/*
+
+message_success "Finished uploading and cleaning."
diff --git a/compose/production/django/Dockerfile b/compose/production/django/Dockerfile
new file mode 100644
index 0000000..502c16e
--- /dev/null
+++ b/compose/production/django/Dockerfile
@@ -0,0 +1,96 @@
+
+# define an alias for the specific python version used in this file.
+FROM docker.io/python:3.12.3-slim-bookworm as python
+
+# Python build stage
+FROM python as python-build-stage
+
+ARG BUILD_ENVIRONMENT=production
+
+# Install apt packages
+RUN apt-get update && apt-get install --no-install-recommends -y \
+ # dependencies for building Python packages
+ build-essential \
+ # psycopg dependencies
+ libpq-dev
+
+# Requirements are installed here to ensure they will be cached.
+COPY ./requirements .
+
+# Create Python Dependency and Sub-Dependency Wheels.
+RUN pip wheel --wheel-dir /usr/src/app/wheels \
+ -r ${BUILD_ENVIRONMENT}.txt
+
+
+# Python 'run' stage
+FROM python as python-run-stage
+
+ARG BUILD_ENVIRONMENT=production
+ARG APP_HOME=/app
+
+ENV PYTHONUNBUFFERED 1
+ENV PYTHONDONTWRITEBYTECODE 1
+ENV BUILD_ENV ${BUILD_ENVIRONMENT}
+
+WORKDIR ${APP_HOME}
+
+RUN addgroup --system django \
+ && adduser --system --ingroup django django
+
+
+# Install required system dependencies
+RUN apt-get update && apt-get install --no-install-recommends -y \
+ # psycopg dependencies
+ libpq-dev \
+ # Translations dependencies
+ gettext \
+ # cleaning up unused files
+ && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
+ && rm -rf /var/lib/apt/lists/*
+
+# All absolute dir copies ignore workdir instruction. All relative dir copies are wrt to the workdir instruction
+# copy python dependency wheels from python-build-stage
+COPY --from=python-build-stage /usr/src/app/wheels /wheels/
+
+# use wheels to install python dependencies
+RUN pip install --no-cache-dir --no-index --find-links=/wheels/ /wheels/* \
+ && rm -rf /wheels/
+
+
+COPY --chown=django:django ./compose/production/django/entrypoint /entrypoint
+RUN sed -i 's/\r$//g' /entrypoint
+RUN chmod +x /entrypoint
+
+
+COPY --chown=django:django ./compose/production/django/start /start
+RUN sed -i 's/\r$//g' /start
+RUN chmod +x /start
+COPY --chown=django:django ./compose/production/django/celery/worker/start /start-celeryworker
+RUN sed -i 's/\r$//g' /start-celeryworker
+RUN chmod +x /start-celeryworker
+
+
+COPY --chown=django:django ./compose/production/django/celery/beat/start /start-celerybeat
+RUN sed -i 's/\r$//g' /start-celerybeat
+RUN chmod +x /start-celerybeat
+
+
+COPY --chown=django:django ./compose/production/django/celery/flower/start /start-flower
+RUN sed -i 's/\r$//g' /start-flower
+RUN chmod +x /start-flower
+
+
+# copy application code to WORKDIR
+COPY --chown=django:django . ${APP_HOME}
+
+# make django owner of the WORKDIR directory as well.
+RUN chown -R django:django ${APP_HOME}
+
+USER django
+
+RUN DATABASE_URL="" \
+ CELERY_BROKER_URL="" \
+ DJANGO_SETTINGS_MODULE="config.settings.test" \
+ python manage.py compilemessages
+
+ENTRYPOINT ["/entrypoint"]
diff --git a/compose/production/django/celery/beat/start b/compose/production/django/celery/beat/start
new file mode 100644
index 0000000..42ddca9
--- /dev/null
+++ b/compose/production/django/celery/beat/start
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+set -o errexit
+set -o pipefail
+set -o nounset
+
+
+exec celery -A config.celery_app beat -l INFO
diff --git a/compose/production/django/celery/flower/start b/compose/production/django/celery/flower/start
new file mode 100644
index 0000000..4180d67
--- /dev/null
+++ b/compose/production/django/celery/flower/start
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+set -o errexit
+set -o nounset
+
+
+exec celery \
+ -A config.celery_app \
+ -b "${CELERY_BROKER_URL}" \
+ flower \
+ --basic_auth="${CELERY_FLOWER_USER}:${CELERY_FLOWER_PASSWORD}"
diff --git a/compose/production/django/celery/worker/start b/compose/production/django/celery/worker/start
new file mode 100644
index 0000000..af0c8f7
--- /dev/null
+++ b/compose/production/django/celery/worker/start
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+set -o errexit
+set -o pipefail
+set -o nounset
+
+
+exec celery -A config.celery_app worker -l INFO
diff --git a/compose/production/django/entrypoint b/compose/production/django/entrypoint
new file mode 100644
index 0000000..249d8d9
--- /dev/null
+++ b/compose/production/django/entrypoint
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+set -o errexit
+set -o pipefail
+set -o nounset
+
+
+
+# N.B. If only .env files supported variable expansion...
+export CELERY_BROKER_URL="${REDIS_URL}"
+
+
+if [ -z "${POSTGRES_USER}" ]; then
+ base_postgres_image_default_user='postgres'
+ export POSTGRES_USER="${base_postgres_image_default_user}"
+fi
+export DATABASE_URL="postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}"
+
+python << END
+import sys
+import time
+
+import psycopg
+
+suggest_unrecoverable_after = 30
+start = time.time()
+
+while True:
+ try:
+ psycopg.connect(
+ dbname="${POSTGRES_DB}",
+ user="${POSTGRES_USER}",
+ password="${POSTGRES_PASSWORD}",
+ host="${POSTGRES_HOST}",
+ port="${POSTGRES_PORT}",
+ )
+ break
+ except psycopg.OperationalError as error:
+ sys.stderr.write("Waiting for PostgreSQL to become available...\n")
+
+ if time.time() - start > suggest_unrecoverable_after:
+ sys.stderr.write(" This is taking longer than expected. The following exception may be indicative of an unrecoverable error: '{}'\n".format(error))
+
+ time.sleep(1)
+END
+
+>&2 echo 'PostgreSQL is available'
+
+exec "$@"
diff --git a/compose/production/django/start b/compose/production/django/start
new file mode 100644
index 0000000..97216fa
--- /dev/null
+++ b/compose/production/django/start
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+set -o errexit
+set -o pipefail
+set -o nounset
+
+
+python /app/manage.py collectstatic --noinput
+
+exec /usr/local/bin/gunicorn config.wsgi --bind 0.0.0.0:5000 --chdir=/app
diff --git a/compose/production/nginx/Dockerfile b/compose/production/nginx/Dockerfile
new file mode 100644
index 0000000..ec2ad35
--- /dev/null
+++ b/compose/production/nginx/Dockerfile
@@ -0,0 +1,2 @@
+FROM docker.io/nginx:1.17.8-alpine
+COPY ./compose/production/nginx/default.conf /etc/nginx/conf.d/default.conf
diff --git a/compose/production/nginx/default.conf b/compose/production/nginx/default.conf
new file mode 100644
index 0000000..562dba8
--- /dev/null
+++ b/compose/production/nginx/default.conf
@@ -0,0 +1,7 @@
+server {
+ listen 80;
+ server_name localhost;
+ location /media/ {
+ alias /usr/share/nginx/media/;
+ }
+}
diff --git a/compose/production/postgres/Dockerfile b/compose/production/postgres/Dockerfile
new file mode 100644
index 0000000..176a5f1
--- /dev/null
+++ b/compose/production/postgres/Dockerfile
@@ -0,0 +1,6 @@
+FROM docker.io/postgres:16
+
+COPY ./compose/production/postgres/maintenance /usr/local/bin/maintenance
+RUN chmod +x /usr/local/bin/maintenance/*
+RUN mv /usr/local/bin/maintenance/* /usr/local/bin \
+ && rmdir /usr/local/bin/maintenance
diff --git a/compose/production/postgres/maintenance/_sourced/constants.sh b/compose/production/postgres/maintenance/_sourced/constants.sh
new file mode 100644
index 0000000..6ca4f0c
--- /dev/null
+++ b/compose/production/postgres/maintenance/_sourced/constants.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+
+
+BACKUP_DIR_PATH='/backups'
+BACKUP_FILE_PREFIX='backup'
diff --git a/compose/production/postgres/maintenance/_sourced/countdown.sh b/compose/production/postgres/maintenance/_sourced/countdown.sh
new file mode 100644
index 0000000..e6cbfb6
--- /dev/null
+++ b/compose/production/postgres/maintenance/_sourced/countdown.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+
+
+countdown() {
+ declare desc="A simple countdown. Source: https://superuser.com/a/611582"
+ local seconds="${1}"
+ local d=$(($(date +%s) + "${seconds}"))
+ while [ "$d" -ge `date +%s` ]; do
+ echo -ne "$(date -u --date @$(($d - `date +%s`)) +%H:%M:%S)\r";
+ sleep 0.1
+ done
+}
diff --git a/compose/production/postgres/maintenance/_sourced/messages.sh b/compose/production/postgres/maintenance/_sourced/messages.sh
new file mode 100644
index 0000000..f6be756
--- /dev/null
+++ b/compose/production/postgres/maintenance/_sourced/messages.sh
@@ -0,0 +1,41 @@
+#!/usr/bin/env bash
+
+
+message_newline() {
+ echo
+}
+
+message_debug()
+{
+ echo -e "DEBUG: ${@}"
+}
+
+message_welcome()
+{
+ echo -e "\e[1m${@}\e[0m"
+}
+
+message_warning()
+{
+ echo -e "\e[33mWARNING\e[0m: ${@}"
+}
+
+message_error()
+{
+ echo -e "\e[31mERROR\e[0m: ${@}"
+}
+
+message_info()
+{
+ echo -e "\e[37mINFO\e[0m: ${@}"
+}
+
+message_suggestion()
+{
+ echo -e "\e[33mSUGGESTION\e[0m: ${@}"
+}
+
+message_success()
+{
+ echo -e "\e[32mSUCCESS\e[0m: ${@}"
+}
diff --git a/compose/production/postgres/maintenance/_sourced/yes_no.sh b/compose/production/postgres/maintenance/_sourced/yes_no.sh
new file mode 100644
index 0000000..fd9cae1
--- /dev/null
+++ b/compose/production/postgres/maintenance/_sourced/yes_no.sh
@@ -0,0 +1,16 @@
+#!/usr/bin/env bash
+
+
+yes_no() {
+ declare desc="Prompt for confirmation. \$\"\{1\}\": confirmation message."
+ local arg1="${1}"
+
+ local response=
+ read -r -p "${arg1} (y/[n])? " response
+ if [[ "${response}" =~ ^[Yy]$ ]]
+ then
+ exit 0
+ else
+ exit 1
+ fi
+}
diff --git a/compose/production/postgres/maintenance/backup b/compose/production/postgres/maintenance/backup
new file mode 100644
index 0000000..f72304c
--- /dev/null
+++ b/compose/production/postgres/maintenance/backup
@@ -0,0 +1,38 @@
+#!/usr/bin/env bash
+
+
+### Create a database backup.
+###
+### Usage:
+### $ docker compose -f <environment>.yml (exec |run --rm) postgres backup
+
+
+set -o errexit
+set -o pipefail
+set -o nounset
+
+
+working_dir="$(dirname ${0})"
+source "${working_dir}/_sourced/constants.sh"
+source "${working_dir}/_sourced/messages.sh"
+
+
+message_welcome "Backing up the '${POSTGRES_DB}' database..."
+
+
+if [[ "${POSTGRES_USER}" == "postgres" ]]; then
+ message_error "Backing up as 'postgres' user is not supported. Assign 'POSTGRES_USER' env with another one and try again."
+ exit 1
+fi
+
+export PGHOST="${POSTGRES_HOST}"
+export PGPORT="${POSTGRES_PORT}"
+export PGUSER="${POSTGRES_USER}"
+export PGPASSWORD="${POSTGRES_PASSWORD}"
+export PGDATABASE="${POSTGRES_DB}"
+
+backup_filename="${BACKUP_FILE_PREFIX}_$(date +'%Y_%m_%dT%H_%M_%S').sql.gz"
+pg_dump | gzip > "${BACKUP_DIR_PATH}/${backup_filename}"
+
+
+message_success "'${POSTGRES_DB}' database backup '${backup_filename}' has been created and placed in '${BACKUP_DIR_PATH}'."
diff --git a/compose/production/postgres/maintenance/backups b/compose/production/postgres/maintenance/backups
new file mode 100644
index 0000000..a18937d
--- /dev/null
+++ b/compose/production/postgres/maintenance/backups
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+
+
+### View backups.
+###
+### Usage:
+### $ docker compose -f <environment>.yml (exec |run --rm) postgres backups
+
+
+set -o errexit
+set -o pipefail
+set -o nounset
+
+
+working_dir="$(dirname ${0})"
+source "${working_dir}/_sourced/constants.sh"
+source "${working_dir}/_sourced/messages.sh"
+
+
+message_welcome "These are the backups you have got:"
+
+ls -lht "${BACKUP_DIR_PATH}"
diff --git a/compose/production/postgres/maintenance/restore b/compose/production/postgres/maintenance/restore
new file mode 100644
index 0000000..c68f17d
--- /dev/null
+++ b/compose/production/postgres/maintenance/restore
@@ -0,0 +1,55 @@
+#!/usr/bin/env bash
+
+
+### Restore database from a backup.
+###
+### Parameters:
+### <1> filename of an existing backup.
+###
+### Usage:
+### $ docker compose -f <environment>.yml (exec |run --rm) postgres restore <1>
+
+
+set -o errexit
+set -o pipefail
+set -o nounset
+
+
+working_dir="$(dirname ${0})"
+source "${working_dir}/_sourced/constants.sh"
+source "${working_dir}/_sourced/messages.sh"
+
+
+if [[ -z ${1+x} ]]; then
+ message_error "Backup filename is not specified yet it is a required parameter. Make sure you provide one and try again."
+ exit 1
+fi
+backup_filename="${BACKUP_DIR_PATH}/${1}"
+if [[ ! -f "${backup_filename}" ]]; then
+ message_error "No backup with the specified filename found. Check out the 'backups' maintenance script output to see if there is one and try again."
+ exit 1
+fi
+
+message_welcome "Restoring the '${POSTGRES_DB}' database from the '${backup_filename}' backup..."
+
+if [[ "${POSTGRES_USER}" == "postgres" ]]; then
+ message_error "Restoring as 'postgres' user is not supported. Assign 'POSTGRES_USER' env with another one and try again."
+ exit 1
+fi
+
+export PGHOST="${POSTGRES_HOST}"
+export PGPORT="${POSTGRES_PORT}"
+export PGUSER="${POSTGRES_USER}"
+export PGPASSWORD="${POSTGRES_PASSWORD}"
+export PGDATABASE="${POSTGRES_DB}"
+
+message_info "Dropping the database..."
+dropdb "${PGDATABASE}"
+
+message_info "Creating a new database..."
+createdb --owner="${POSTGRES_USER}"
+
+message_info "Applying the backup to the new database..."
+gunzip -c "${backup_filename}" | psql "${POSTGRES_DB}"
+
+message_success "The '${POSTGRES_DB}' database has been restored from the '${backup_filename}' backup."
diff --git a/compose/production/postgres/maintenance/rmbackup b/compose/production/postgres/maintenance/rmbackup
new file mode 100644
index 0000000..fdfd20e
--- /dev/null
+++ b/compose/production/postgres/maintenance/rmbackup
@@ -0,0 +1,36 @@
+#!/usr/bin/env bash
+
+### Remove a database backup.
+###
+### Parameters:
+### <1> filename of a backup to remove.
+###
+### Usage:
+### $ docker-compose -f <environment>.yml (exec |run --rm) postgres rmbackup <1>
+
+
+set -o errexit
+set -o pipefail
+set -o nounset
+
+
+working_dir="$(dirname ${0})"
+source "${working_dir}/_sourced/constants.sh"
+source "${working_dir}/_sourced/messages.sh"
+
+
+if [[ -z ${1+x} ]]; then
+ message_error "Backup filename is not specified yet it is a required parameter. Make sure you provide one and try again."
+ exit 1
+fi
+backup_filename="${BACKUP_DIR_PATH}/${1}"
+if [[ ! -f "${backup_filename}" ]]; then
+ message_error "No backup with the specified filename found. Check out the 'backups' maintenance script output to see if there is one and try again."
+ exit 1
+fi
+
+message_welcome "Removing the '${backup_filename}' backup file..."
+
+rm -r "${backup_filename}"
+
+message_success "The '${backup_filename}' database backup has been removed."
diff --git a/compose/production/traefik/Dockerfile b/compose/production/traefik/Dockerfile
new file mode 100644
index 0000000..d54bf27
--- /dev/null
+++ b/compose/production/traefik/Dockerfile
@@ -0,0 +1,5 @@
+FROM docker.io/traefik:2.11.2
+RUN mkdir -p /etc/traefik/acme \
+ && touch /etc/traefik/acme/acme.json \
+ && chmod 600 /etc/traefik/acme/acme.json
+COPY ./compose/production/traefik/traefik.yml /etc/traefik
diff --git a/compose/production/traefik/traefik.yml b/compose/production/traefik/traefik.yml
new file mode 100644
index 0000000..4c274d1
--- /dev/null
+++ b/compose/production/traefik/traefik.yml
@@ -0,0 +1,75 @@
+log:
+ level: INFO
+
+entryPoints:
+ web:
+ # http
+ address: ':80'
+ http:
+ # https://doc.traefik.io/traefik/routing/entrypoints/#entrypoint
+ redirections:
+ entryPoint:
+ to: web-secure
+
+ web-secure:
+ # https
+ address: ':443'
+
+ flower:
+ address: ':5555'
+
+certificatesResolvers:
+ letsencrypt:
+ # https://doc.traefik.io/traefik/https/acme/#lets-encrypt
+ acme:
+ email: 'y@yulqen.org'
+ storage: /etc/traefik/acme/acme.json
+ # https://doc.traefik.io/traefik/https/acme/#httpchallenge
+ httpChallenge:
+ entryPoint: web
+
+http:
+ routers:
+ web-secure-router:
+ rule: 'Host(`resources.joannalemon.com`)'
+ entryPoints:
+ - web-secure
+ middlewares:
+ - csrf
+ service: django
+ tls:
+ # https://doc.traefik.io/traefik/routing/routers/#certresolver
+ certResolver: letsencrypt
+
+ flower-secure-router:
+ rule: 'Host(`resources.joannalemon.com`)'
+ entryPoints:
+ - flower
+ service: flower
+ tls:
+ # https://doc.traefik.io/traefik/master/routing/routers/#certresolver
+ certResolver: letsencrypt
+
+ middlewares:
+ csrf:
+ # https://doc.traefik.io/traefik/master/middlewares/http/headers/#hostsproxyheaders
+ # https://docs.djangoproject.com/en/dev/ref/csrf/#ajax
+ headers:
+ hostsProxyHeaders: ['X-CSRFToken']
+
+ services:
+ django:
+ loadBalancer:
+ servers:
+ - url: http://django:5000
+
+ flower:
+ loadBalancer:
+ servers:
+ - url: http://flower:5555
+
+providers:
+ # https://doc.traefik.io/traefik/master/providers/file/
+ file:
+ filename: /etc/traefik/traefik.yml
+ watch: true
diff --git a/config/__init__.py b/config/__init__.py
new file mode 100644
index 0000000..10f5014
--- /dev/null
+++ b/config/__init__.py
@@ -0,0 +1,5 @@
+# This will make sure the app is always imported when
+# Django starts so that shared_task will use this app.
+from .celery_app import app as celery_app
+
+__all__ = ("celery_app",)
diff --git a/config/celery_app.py b/config/celery_app.py
new file mode 100644
index 0000000..b4ab45c
--- /dev/null
+++ b/config/celery_app.py
@@ -0,0 +1,17 @@
+import os
+
+from celery import Celery
+
+# set the default Django settings module for the 'celery' program.
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")
+
+app = Celery("pyblackbird_cc")
+
+# Using a string here means the worker doesn't have to serialize
+# the configuration object to child processes.
+# - namespace='CELERY' means all celery-related configuration keys
+# should have a `CELERY_` prefix.
+app.config_from_object("django.conf:settings", namespace="CELERY")
+
+# Load task modules from all registered Django app configs.
+app.autodiscover_tasks()
diff --git a/config/settings/__init__.py b/config/settings/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/config/settings/__init__.py
diff --git a/config/settings/base.py b/config/settings/base.py
new file mode 100644
index 0000000..3c11aee
--- /dev/null
+++ b/config/settings/base.py
@@ -0,0 +1,319 @@
+# ruff: noqa: ERA001, E501
+"""Base settings to build other settings files upon."""
+
+from pathlib import Path
+
+import environ
+
+BASE_DIR = Path(__file__).resolve(strict=True).parent.parent.parent
+# pyblackbird_cc/
+APPS_DIR = BASE_DIR / "pyblackbird_cc"
+env = environ.Env()
+
+READ_DOT_ENV_FILE = env.bool("DJANGO_READ_DOT_ENV_FILE", default=False)
+if READ_DOT_ENV_FILE:
+ # OS environment variables take precedence over variables from .env
+ env.read_env(str(BASE_DIR / ".env"))
+
+# GENERAL
+# ------------------------------------------------------------------------------
+# https://docs.djangoproject.com/en/dev/ref/settings/#debug
+DEBUG = env.bool("DJANGO_DEBUG", False)
+# Local time zone. Choices are
+# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
+# though not all of them may be available with every OS.
+# In Windows, this must be set to your system time zone.
+TIME_ZONE = "UTC"
+# https://docs.djangoproject.com/en/dev/ref/settings/#language-code
+LANGUAGE_CODE = "en-us"
+# https://docs.djangoproject.com/en/dev/ref/settings/#languages
+# from django.utils.translation import gettext_lazy as _
+# LANGUAGES = [
+# ('en', _('English')),
+# ('fr-fr', _('French')),
+# ('pt-br', _('Portuguese')),
+# ]
+# https://docs.djangoproject.com/en/dev/ref/settings/#site-id
+SITE_ID = 1
+# https://docs.djangoproject.com/en/dev/ref/settings/#use-i18n
+USE_I18N = True
+# https://docs.djangoproject.com/en/dev/ref/settings/#use-tz
+USE_TZ = True
+# https://docs.djangoproject.com/en/dev/ref/settings/#locale-paths
+LOCALE_PATHS = [str(BASE_DIR / "locale")]
+
+# DATABASES
+# ------------------------------------------------------------------------------
+# https://docs.djangoproject.com/en/dev/ref/settings/#databases
+DATABASES = {"default": env.db("DATABASE_URL")}
+DATABASES["default"]["ATOMIC_REQUESTS"] = True
+# https://docs.djangoproject.com/en/stable/ref/settings/#std:setting-DEFAULT_AUTO_FIELD
+DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
+
+# URLS
+# ------------------------------------------------------------------------------
+# https://docs.djangoproject.com/en/dev/ref/settings/#root-urlconf
+ROOT_URLCONF = "config.urls"
+# https://docs.djangoproject.com/en/dev/ref/settings/#wsgi-application
+WSGI_APPLICATION = "config.wsgi.application"
+
+# APPS
+# ------------------------------------------------------------------------------
+DJANGO_APPS = [
+ "django.contrib.auth",
+ "django.contrib.contenttypes",
+ "django.contrib.sessions",
+ "django.contrib.sites",
+ "django.contrib.messages",
+ "django.contrib.staticfiles",
+ # "django.contrib.humanize", # Handy template tags
+ "django.contrib.admin",
+ "django.forms",
+]
+THIRD_PARTY_APPS = [
+ "crispy_forms",
+ "crispy_bootstrap5",
+ "allauth",
+ "allauth.account",
+ "allauth.mfa",
+ "allauth.socialaccount",
+ "django_celery_beat",
+]
+
+LOCAL_APPS = [
+ "pyblackbird_cc.users",
+ "pyblackbird_cc.resources",
+ # Your stuff: custom apps go here
+]
+# https://docs.djangoproject.com/en/dev/ref/settings/#installed-apps
+INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS
+
+# MIGRATIONS
+# ------------------------------------------------------------------------------
+# https://docs.djangoproject.com/en/dev/ref/settings/#migration-modules
+MIGRATION_MODULES = {"sites": "pyblackbird_cc.contrib.sites.migrations"}
+
+# AUTHENTICATION
+# ------------------------------------------------------------------------------
+# https://docs.djangoproject.com/en/dev/ref/settings/#authentication-backends
+AUTHENTICATION_BACKENDS = [
+ "django.contrib.auth.backends.ModelBackend",
+ "allauth.account.auth_backends.AuthenticationBackend",
+]
+# https://docs.djangoproject.com/en/dev/ref/settings/#auth-user-model
+AUTH_USER_MODEL = "users.User"
+# https://docs.djangoproject.com/en/dev/ref/settings/#login-redirect-url
+LOGIN_REDIRECT_URL = "users:redirect"
+# https://docs.djangoproject.com/en/dev/ref/settings/#login-url
+LOGIN_URL = "account_login"
+
+# PASSWORDS
+# ------------------------------------------------------------------------------
+# https://docs.djangoproject.com/en/dev/ref/settings/#password-hashers
+PASSWORD_HASHERS = [
+ # https://docs.djangoproject.com/en/dev/topics/auth/passwords/#using-argon2-with-django
+ "django.contrib.auth.hashers.Argon2PasswordHasher",
+ "django.contrib.auth.hashers.PBKDF2PasswordHasher",
+ "django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher",
+ "django.contrib.auth.hashers.BCryptSHA256PasswordHasher",
+]
+# https://docs.djangoproject.com/en/dev/ref/settings/#auth-password-validators
+AUTH_PASSWORD_VALIDATORS = [
+ {
+ "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
+ },
+ {"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator"},
+ {"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator"},
+ {"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator"},
+]
+
+# MIDDLEWARE
+# ------------------------------------------------------------------------------
+# https://docs.djangoproject.com/en/dev/ref/settings/#middleware
+MIDDLEWARE = [
+ "django.middleware.security.SecurityMiddleware",
+ "whitenoise.middleware.WhiteNoiseMiddleware",
+ "django.contrib.sessions.middleware.SessionMiddleware",
+ "django.middleware.locale.LocaleMiddleware",
+ "django.middleware.common.CommonMiddleware",
+ "django.middleware.csrf.CsrfViewMiddleware",
+ "django.contrib.auth.middleware.AuthenticationMiddleware",
+ "django.contrib.messages.middleware.MessageMiddleware",
+ "django.middleware.clickjacking.XFrameOptionsMiddleware",
+ "allauth.account.middleware.AccountMiddleware",
+]
+
+# STATIC
+# ------------------------------------------------------------------------------
+# https://docs.djangoproject.com/en/dev/ref/settings/#static-root
+STATIC_ROOT = str(BASE_DIR / "staticfiles")
+# https://docs.djangoproject.com/en/dev/ref/settings/#static-url
+STATIC_URL = "/static/"
+# https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#std:setting-STATICFILES_DIRS
+STATICFILES_DIRS = [str(APPS_DIR / "static")]
+# https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#staticfiles-finders
+STATICFILES_FINDERS = [
+ "django.contrib.staticfiles.finders.FileSystemFinder",
+ "django.contrib.staticfiles.finders.AppDirectoriesFinder",
+]
+
+# MEDIA
+# ------------------------------------------------------------------------------
+# https://docs.djangoproject.com/en/dev/ref/settings/#media-root
+MEDIA_ROOT = str(APPS_DIR / "media")
+# https://docs.djangoproject.com/en/dev/ref/settings/#media-url
+MEDIA_URL = "/media/"
+
+# TEMPLATES
+# ------------------------------------------------------------------------------
+# https://docs.djangoproject.com/en/dev/ref/settings/#templates
+TEMPLATES = [
+ {
+ # https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-TEMPLATES-BACKEND
+ "BACKEND": "django.template.backends.django.DjangoTemplates",
+ # https://docs.djangoproject.com/en/dev/ref/settings/#dirs
+ "DIRS": [str(APPS_DIR / "templates")],
+ # https://docs.djangoproject.com/en/dev/ref/settings/#app-dirs
+ "APP_DIRS": True,
+ "OPTIONS": {
+ # https://docs.djangoproject.com/en/dev/ref/settings/#template-context-processors
+ "context_processors": [
+ "django.template.context_processors.debug",
+ "django.template.context_processors.request",
+ "django.contrib.auth.context_processors.auth",
+ "django.template.context_processors.i18n",
+ "django.template.context_processors.media",
+ "django.template.context_processors.static",
+ "django.template.context_processors.tz",
+ "django.contrib.messages.context_processors.messages",
+ "pyblackbird_cc.users.context_processors.allauth_settings",
+ ],
+ },
+ },
+]
+
+# https://docs.djangoproject.com/en/dev/ref/settings/#form-renderer
+FORM_RENDERER = "django.forms.renderers.TemplatesSetting"
+
+# http://django-crispy-forms.readthedocs.io/en/latest/install.html#template-packs
+CRISPY_TEMPLATE_PACK = "bootstrap5"
+CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap5"
+
+# FIXTURES
+# ------------------------------------------------------------------------------
+# https://docs.djangoproject.com/en/dev/ref/settings/#fixture-dirs
+FIXTURE_DIRS = (str(APPS_DIR / "fixtures"),)
+
+# SECURITY
+# ------------------------------------------------------------------------------
+# https://docs.djangoproject.com/en/dev/ref/settings/#session-cookie-httponly
+SESSION_COOKIE_HTTPONLY = True
+# https://docs.djangoproject.com/en/dev/ref/settings/#csrf-cookie-httponly
+CSRF_COOKIE_HTTPONLY = True
+# https://docs.djangoproject.com/en/dev/ref/settings/#x-frame-options
+X_FRAME_OPTIONS = "DENY"
+
+# EMAIL
+# ------------------------------------------------------------------------------
+# https://docs.djangoproject.com/en/dev/ref/settings/#email-backend
+EMAIL_BACKEND = env(
+ "DJANGO_EMAIL_BACKEND",
+ default="django.core.mail.backends.smtp.EmailBackend",
+)
+# https://docs.djangoproject.com/en/dev/ref/settings/#email-timeout
+EMAIL_TIMEOUT = 5
+
+# ADMIN
+# ------------------------------------------------------------------------------
+# Django Admin URL.
+ADMIN_URL = "admin/"
+# https://docs.djangoproject.com/en/dev/ref/settings/#admins
+ADMINS = [("""Matthew Lemon""", "y@yulqen.org")]
+# https://docs.djangoproject.com/en/dev/ref/settings/#managers
+MANAGERS = ADMINS
+# https://cookiecutter-django.readthedocs.io/en/latest/settings.html#other-environment-settings
+# Force the `admin` sign in process to go through the `django-allauth` workflow
+DJANGO_ADMIN_FORCE_ALLAUTH = env.bool("DJANGO_ADMIN_FORCE_ALLAUTH", default=False)
+
+# LOGGING
+# ------------------------------------------------------------------------------
+# https://docs.djangoproject.com/en/dev/ref/settings/#logging
+# See https://docs.djangoproject.com/en/dev/topics/logging for
+# more details on how to customize your logging configuration.
+LOGGING = {
+ "version": 1,
+ "disable_existing_loggers": False,
+ "formatters": {
+ "verbose": {
+ "format": "%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s",
+ },
+ },
+ "handlers": {
+ "console": {
+ "level": "DEBUG",
+ "class": "logging.StreamHandler",
+ "formatter": "verbose",
+ },
+ },
+ "root": {"level": "INFO", "handlers": ["console"]},
+}
+
+# Celery
+# ------------------------------------------------------------------------------
+if USE_TZ:
+ # https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-timezone
+ CELERY_TIMEZONE = TIME_ZONE
+# https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-broker_url
+CELERY_BROKER_URL = env("CELERY_BROKER_URL")
+# https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-result_backend
+CELERY_RESULT_BACKEND = CELERY_BROKER_URL
+# https://docs.celeryq.dev/en/stable/userguide/configuration.html#result-extended
+CELERY_RESULT_EXTENDED = True
+# https://docs.celeryq.dev/en/stable/userguide/configuration.html#result-backend-always-retry
+# https://github.com/celery/celery/pull/6122
+CELERY_RESULT_BACKEND_ALWAYS_RETRY = True
+# https://docs.celeryq.dev/en/stable/userguide/configuration.html#result-backend-max-retries
+CELERY_RESULT_BACKEND_MAX_RETRIES = 10
+# https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-accept_content
+CELERY_ACCEPT_CONTENT = ["json"]
+# https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-task_serializer
+CELERY_TASK_SERIALIZER = "json"
+# https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-result_serializer
+CELERY_RESULT_SERIALIZER = "json"
+# https://docs.celeryq.dev/en/stable/userguide/configuration.html#task-time-limit
+# TODO: set to whatever value is adequate in your circumstances
+CELERY_TASK_TIME_LIMIT = 5 * 60
+# https://docs.celeryq.dev/en/stable/userguide/configuration.html#task-soft-time-limit
+# TODO: set to whatever value is adequate in your circumstances
+CELERY_TASK_SOFT_TIME_LIMIT = 60
+# https://docs.celeryq.dev/en/stable/userguide/configuration.html#beat-scheduler
+CELERY_BEAT_SCHEDULER = "django_celery_beat.schedulers:DatabaseScheduler"
+# https://docs.celeryq.dev/en/stable/userguide/configuration.html#worker-send-task-events
+CELERY_WORKER_SEND_TASK_EVENTS = True
+# https://docs.celeryq.dev/en/stable/userguide/configuration.html#std-setting-task_send_sent_event
+CELERY_TASK_SEND_SENT_EVENT = True
+# django-allauth
+# ------------------------------------------------------------------------------
+ACCOUNT_ALLOW_REGISTRATION = env.bool("DJANGO_ACCOUNT_ALLOW_REGISTRATION", True)
+# https://docs.allauth.org/en/latest/account/configuration.html
+ACCOUNT_AUTHENTICATION_METHOD = "email"
+# https://docs.allauth.org/en/latest/account/configuration.html
+ACCOUNT_EMAIL_REQUIRED = True
+# https://docs.allauth.org/en/latest/account/configuration.html
+ACCOUNT_USERNAME_REQUIRED = False
+# https://docs.allauth.org/en/latest/account/configuration.html
+ACCOUNT_USER_MODEL_USERNAME_FIELD = None
+# https://docs.allauth.org/en/latest/account/configuration.html
+ACCOUNT_EMAIL_VERIFICATION = "mandatory"
+# https://docs.allauth.org/en/latest/account/configuration.html
+ACCOUNT_ADAPTER = "pyblackbird_cc.users.adapters.AccountAdapter"
+# https://docs.allauth.org/en/latest/account/forms.html
+ACCOUNT_FORMS = {"signup": "pyblackbird_cc.users.forms.UserSignupForm"}
+# https://docs.allauth.org/en/latest/socialaccount/configuration.html
+SOCIALACCOUNT_ADAPTER = "pyblackbird_cc.users.adapters.SocialAccountAdapter"
+# https://docs.allauth.org/en/latest/socialaccount/configuration.html
+SOCIALACCOUNT_FORMS = {"signup": "pyblackbird_cc.users.forms.UserSocialSignupForm"}
+
+
+# Your stuff...
+# ------------------------------------------------------------------------------
diff --git a/config/settings/local.py b/config/settings/local.py
new file mode 100644
index 0000000..c27f1b9
--- /dev/null
+++ b/config/settings/local.py
@@ -0,0 +1,71 @@
+# ruff: noqa: E501
+from .base import * # noqa: F403
+from .base import INSTALLED_APPS
+from .base import MIDDLEWARE
+from .base import env
+
+# GENERAL
+# ------------------------------------------------------------------------------
+# https://docs.djangoproject.com/en/dev/ref/settings/#debug
+DEBUG = True
+# https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
+SECRET_KEY = env(
+ "DJANGO_SECRET_KEY",
+ default="4MZuqVXy7rToppiUhiTBxzlQH8OxPDDmu4rsTqFiyAyLF50WPBVzX5ZFBLpwJPyY",
+)
+# https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
+ALLOWED_HOSTS = ["localhost", "0.0.0.0", "127.0.0.1"] # noqa: S104
+
+# CACHES
+# ------------------------------------------------------------------------------
+# https://docs.djangoproject.com/en/dev/ref/settings/#caches
+CACHES = {
+ "default": {
+ "BACKEND": "django.core.cache.backends.locmem.LocMemCache",
+ "LOCATION": "",
+ },
+}
+
+# EMAIL
+# ------------------------------------------------------------------------------
+# https://docs.djangoproject.com/en/dev/ref/settings/#email-host
+EMAIL_HOST = env("EMAIL_HOST", default="mailpit")
+# https://docs.djangoproject.com/en/dev/ref/settings/#email-port
+EMAIL_PORT = 1025
+
+# WhiteNoise
+# ------------------------------------------------------------------------------
+# http://whitenoise.evans.io/en/latest/django.html#using-whitenoise-in-development
+INSTALLED_APPS = ["whitenoise.runserver_nostatic", *INSTALLED_APPS]
+
+
+# django-debug-toolbar
+# ------------------------------------------------------------------------------
+# https://django-debug-toolbar.readthedocs.io/en/latest/installation.html#prerequisites
+INSTALLED_APPS += ["debug_toolbar"]
+# https://django-debug-toolbar.readthedocs.io/en/latest/installation.html#middleware
+MIDDLEWARE += ["debug_toolbar.middleware.DebugToolbarMiddleware"]
+# https://django-debug-toolbar.readthedocs.io/en/latest/configuration.html#debug-toolbar-config
+DEBUG_TOOLBAR_CONFIG = {
+ "DISABLE_PANELS": ["debug_toolbar.panels.redirects.RedirectsPanel"],
+ "SHOW_TEMPLATE_CONTEXT": True,
+}
+# https://django-debug-toolbar.readthedocs.io/en/latest/installation.html#internal-ips
+INTERNAL_IPS = ["127.0.0.1", "10.0.2.2"]
+if env("USE_DOCKER") == "yes":
+ import socket
+
+ hostname, _, ips = socket.gethostbyname_ex(socket.gethostname())
+ INTERNAL_IPS += [".".join(ip.split(".")[:-1] + ["1"]) for ip in ips]
+
+# django-extensions
+# ------------------------------------------------------------------------------
+# https://django-extensions.readthedocs.io/en/latest/installation_instructions.html#configuration
+INSTALLED_APPS += ["django_extensions"]
+# Celery
+# ------------------------------------------------------------------------------
+
+# https://docs.celeryq.dev/en/stable/userguide/configuration.html#task-eager-propagates
+CELERY_TASK_EAGER_PROPAGATES = True
+# Your stuff...
+# ------------------------------------------------------------------------------
diff --git a/config/settings/production.py b/config/settings/production.py
new file mode 100644
index 0000000..a44c994
--- /dev/null
+++ b/config/settings/production.py
@@ -0,0 +1,207 @@
+# ruff: noqa: E501
+import logging
+
+import sentry_sdk
+from sentry_sdk.integrations.celery import CeleryIntegration
+from sentry_sdk.integrations.django import DjangoIntegration
+from sentry_sdk.integrations.logging import LoggingIntegration
+from sentry_sdk.integrations.redis import RedisIntegration
+
+from .base import * # noqa: F403
+from .base import DATABASES
+from .base import INSTALLED_APPS
+from .base import env
+
+# GENERAL
+# ------------------------------------------------------------------------------
+# https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
+SECRET_KEY = env("DJANGO_SECRET_KEY")
+# https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
+ALLOWED_HOSTS = env.list("DJANGO_ALLOWED_HOSTS", default=["resources.joannalemon.com"])
+
+# DATABASES
+# ------------------------------------------------------------------------------
+DATABASES["default"]["CONN_MAX_AGE"] = env.int("CONN_MAX_AGE", default=60)
+
+# CACHES
+# ------------------------------------------------------------------------------
+CACHES = {
+ "default": {
+ "BACKEND": "django_redis.cache.RedisCache",
+ "LOCATION": env("REDIS_URL"),
+ "OPTIONS": {
+ "CLIENT_CLASS": "django_redis.client.DefaultClient",
+ # Mimicing memcache behavior.
+ # https://github.com/jazzband/django-redis#memcached-exceptions-behavior
+ "IGNORE_EXCEPTIONS": True,
+ },
+ },
+}
+
+# SECURITY
+# ------------------------------------------------------------------------------
+# https://docs.djangoproject.com/en/dev/ref/settings/#secure-proxy-ssl-header
+SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
+# https://docs.djangoproject.com/en/dev/ref/settings/#secure-ssl-redirect
+SECURE_SSL_REDIRECT = env.bool("DJANGO_SECURE_SSL_REDIRECT", default=True)
+# https://docs.djangoproject.com/en/dev/ref/settings/#session-cookie-secure
+SESSION_COOKIE_SECURE = True
+# https://docs.djangoproject.com/en/dev/ref/settings/#csrf-cookie-secure
+CSRF_COOKIE_SECURE = True
+# https://docs.djangoproject.com/en/dev/topics/security/#ssl-https
+# https://docs.djangoproject.com/en/dev/ref/settings/#secure-hsts-seconds
+# TODO: set this to 60 seconds first and then to 518400 once you prove the former works
+SECURE_HSTS_SECONDS = 60
+# https://docs.djangoproject.com/en/dev/ref/settings/#secure-hsts-include-subdomains
+SECURE_HSTS_INCLUDE_SUBDOMAINS = env.bool(
+ "DJANGO_SECURE_HSTS_INCLUDE_SUBDOMAINS",
+ default=True,
+)
+# https://docs.djangoproject.com/en/dev/ref/settings/#secure-hsts-preload
+SECURE_HSTS_PRELOAD = env.bool("DJANGO_SECURE_HSTS_PRELOAD", default=True)
+# https://docs.djangoproject.com/en/dev/ref/middleware/#x-content-type-options-nosniff
+SECURE_CONTENT_TYPE_NOSNIFF = env.bool(
+ "DJANGO_SECURE_CONTENT_TYPE_NOSNIFF",
+ default=True,
+)
+
+# STORAGES
+# ------------------------------------------------------------------------------
+# https://django-storages.readthedocs.io/en/latest/#installation
+INSTALLED_APPS += ["storages"]
+# https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html#settings
+AWS_ACCESS_KEY_ID = env("DJANGO_AWS_ACCESS_KEY_ID")
+# https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html#settings
+AWS_SECRET_ACCESS_KEY = env("DJANGO_AWS_SECRET_ACCESS_KEY")
+# https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html#settings
+AWS_STORAGE_BUCKET_NAME = env("DJANGO_AWS_STORAGE_BUCKET_NAME")
+# https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html#settings
+AWS_QUERYSTRING_AUTH = False
+# DO NOT change these unless you know what you're doing.
+_AWS_EXPIRY = 60 * 60 * 24 * 7
+# https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html#settings
+AWS_S3_OBJECT_PARAMETERS = {
+ "CacheControl": f"max-age={_AWS_EXPIRY}, s-maxage={_AWS_EXPIRY}, must-revalidate",
+}
+# https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html#settings
+AWS_S3_MAX_MEMORY_SIZE = env.int(
+ "DJANGO_AWS_S3_MAX_MEMORY_SIZE",
+ default=100_000_000, # 100MB
+)
+# https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html#settings
+AWS_S3_REGION_NAME = env("DJANGO_AWS_S3_REGION_NAME", default=None)
+# https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html#cloudfront
+AWS_S3_CUSTOM_DOMAIN = env("DJANGO_AWS_S3_CUSTOM_DOMAIN", default=None)
+aws_s3_domain = AWS_S3_CUSTOM_DOMAIN or f"{AWS_STORAGE_BUCKET_NAME}.s3.amazonaws.com"
+# STATIC & MEDIA
+# ------------------------
+STORAGES = {
+ "default": {
+ "BACKEND": "django.core.files.storage.FileSystemStorage",
+ },
+ "staticfiles": {
+ "BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage",
+ },
+}
+MEDIA_URL = f"https://{aws_s3_domain}/media/"
+COLLECTFAST_STRATEGY = "collectfast.strategies.boto3.Boto3Strategy"
+STATIC_URL = f"https://{aws_s3_domain}/static/"
+
+# EMAIL
+# ------------------------------------------------------------------------------
+# https://docs.djangoproject.com/en/dev/ref/settings/#default-from-email
+DEFAULT_FROM_EMAIL = env(
+ "DJANGO_DEFAULT_FROM_EMAIL",
+ default="pyblackbird-cc <noreply@resources.joannalemon.com>",
+)
+# https://docs.djangoproject.com/en/dev/ref/settings/#server-email
+SERVER_EMAIL = env("DJANGO_SERVER_EMAIL", default=DEFAULT_FROM_EMAIL)
+# https://docs.djangoproject.com/en/dev/ref/settings/#email-subject-prefix
+EMAIL_SUBJECT_PREFIX = env(
+ "DJANGO_EMAIL_SUBJECT_PREFIX",
+ default="[pyblackbird-cc] ",
+)
+
+# ADMIN
+# ------------------------------------------------------------------------------
+# Django Admin URL regex.
+ADMIN_URL = env("DJANGO_ADMIN_URL")
+
+# Anymail
+# ------------------------------------------------------------------------------
+# https://anymail.readthedocs.io/en/stable/installation/#installing-anymail
+INSTALLED_APPS += ["anymail"]
+# https://docs.djangoproject.com/en/dev/ref/settings/#email-backend
+# https://anymail.readthedocs.io/en/stable/installation/#anymail-settings-reference
+# https://anymail.readthedocs.io/en/stable/esps/mailgun/
+EMAIL_BACKEND = "anymail.backends.mailgun.EmailBackend"
+ANYMAIL = {
+ "MAILGUN_API_KEY": env("MAILGUN_API_KEY"),
+ "MAILGUN_SENDER_DOMAIN": env("MAILGUN_DOMAIN"),
+ "MAILGUN_API_URL": env("MAILGUN_API_URL", default="https://api.mailgun.net/v3"),
+}
+
+
+# LOGGING
+# ------------------------------------------------------------------------------
+# https://docs.djangoproject.com/en/dev/ref/settings/#logging
+# See https://docs.djangoproject.com/en/dev/topics/logging for
+# more details on how to customize your logging configuration.
+
+LOGGING = {
+ "version": 1,
+ "disable_existing_loggers": True,
+ "formatters": {
+ "verbose": {
+ "format": "%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s",
+ },
+ },
+ "handlers": {
+ "console": {
+ "level": "DEBUG",
+ "class": "logging.StreamHandler",
+ "formatter": "verbose",
+ },
+ },
+ "root": {"level": "INFO", "handlers": ["console"]},
+ "loggers": {
+ "django.db.backends": {
+ "level": "ERROR",
+ "handlers": ["console"],
+ "propagate": False,
+ },
+ # Errors logged by the SDK itself
+ "sentry_sdk": {"level": "ERROR", "handlers": ["console"], "propagate": False},
+ "django.security.DisallowedHost": {
+ "level": "ERROR",
+ "handlers": ["console"],
+ "propagate": False,
+ },
+ },
+}
+
+# Sentry
+# ------------------------------------------------------------------------------
+SENTRY_DSN = env("SENTRY_DSN")
+SENTRY_LOG_LEVEL = env.int("DJANGO_SENTRY_LOG_LEVEL", logging.INFO)
+
+sentry_logging = LoggingIntegration(
+ level=SENTRY_LOG_LEVEL, # Capture info and above as breadcrumbs
+ event_level=logging.ERROR, # Send errors as events
+)
+integrations = [
+ sentry_logging,
+ DjangoIntegration(),
+ CeleryIntegration(),
+ RedisIntegration(),
+]
+sentry_sdk.init(
+ dsn=SENTRY_DSN,
+ integrations=integrations,
+ environment=env("SENTRY_ENVIRONMENT", default="production"),
+ traces_sample_rate=env.float("SENTRY_TRACES_SAMPLE_RATE", default=0.0),
+)
+
+
+# Your stuff...
+# ------------------------------------------------------------------------------
diff --git a/config/settings/test.py b/config/settings/test.py
new file mode 100644
index 0000000..07380c0
--- /dev/null
+++ b/config/settings/test.py
@@ -0,0 +1,38 @@
+"""
+With these settings, tests run faster.
+"""
+
+from .base import * # noqa: F403
+from .base import TEMPLATES
+from .base import env
+
+# GENERAL
+# ------------------------------------------------------------------------------
+# https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
+SECRET_KEY = env(
+ "DJANGO_SECRET_KEY",
+ default="2uUCs0i1i4UXRmFVrg0FQ7YbKuyWFBCAbeheVhs3GqVpFploH78TqxD8jfN3T6R8",
+)
+# https://docs.djangoproject.com/en/dev/ref/settings/#test-runner
+TEST_RUNNER = "django.test.runner.DiscoverRunner"
+
+# PASSWORDS
+# ------------------------------------------------------------------------------
+# https://docs.djangoproject.com/en/dev/ref/settings/#password-hashers
+PASSWORD_HASHERS = ["django.contrib.auth.hashers.MD5PasswordHasher"]
+
+# EMAIL
+# ------------------------------------------------------------------------------
+# https://docs.djangoproject.com/en/dev/ref/settings/#email-backend
+EMAIL_BACKEND = "django.core.mail.backends.locmem.EmailBackend"
+
+# DEBUGGING FOR TEMPLATES
+# ------------------------------------------------------------------------------
+TEMPLATES[0]["OPTIONS"]["debug"] = True # type: ignore[index]
+
+# MEDIA
+# ------------------------------------------------------------------------------
+# https://docs.djangoproject.com/en/dev/ref/settings/#media-url
+MEDIA_URL = "http://media.testserver"
+# Your stuff...
+# ------------------------------------------------------------------------------
diff --git a/config/urls.py b/config/urls.py
new file mode 100644
index 0000000..bc672a5
--- /dev/null
+++ b/config/urls.py
@@ -0,0 +1,53 @@
+# ruff: noqa
+from django.conf import settings
+from django.conf.urls.static import static
+from django.contrib import admin
+from django.urls import include
+from django.urls import path
+from django.views import defaults as default_views
+from django.views.generic import TemplateView
+
+urlpatterns = [
+ path("", TemplateView.as_view(template_name="pages/home.html"), name="home"),
+ path(
+ "about/",
+ TemplateView.as_view(template_name="pages/about.html"),
+ name="about",
+ ),
+ # Django Admin, use {% url 'admin:index' %}
+ path(settings.ADMIN_URL, admin.site.urls),
+ # User management
+ path("users/", include("pyblackbird_cc.users.urls", namespace="users")),
+ path("accounts/", include("allauth.urls")),
+ # Your stuff: custom urls includes go here
+ # ...
+ # Media files
+ *static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT),
+]
+
+
+if settings.DEBUG:
+ # This allows the error pages to be debugged during development, just visit
+ # these url in browser to see how these error pages look like.
+ urlpatterns += [
+ path(
+ "400/",
+ default_views.bad_request,
+ kwargs={"exception": Exception("Bad Request!")},
+ ),
+ path(
+ "403/",
+ default_views.permission_denied,
+ kwargs={"exception": Exception("Permission Denied")},
+ ),
+ path(
+ "404/",
+ default_views.page_not_found,
+ kwargs={"exception": Exception("Page not Found")},
+ ),
+ path("500/", default_views.server_error),
+ ]
+ if "debug_toolbar" in settings.INSTALLED_APPS:
+ import debug_toolbar
+
+ urlpatterns = [path("__debug__/", include(debug_toolbar.urls))] + urlpatterns
diff --git a/config/wsgi.py b/config/wsgi.py
new file mode 100644
index 0000000..96dd59f
--- /dev/null
+++ b/config/wsgi.py
@@ -0,0 +1,40 @@
+# ruff: noqa
+"""
+WSGI config for pyblackbird-cc project.
+
+This module contains the WSGI application used by Django's development server
+and any production WSGI deployments. It should expose a module-level variable
+named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
+this application via the ``WSGI_APPLICATION`` setting.
+
+Usually you will have the standard Django WSGI application here, but it also
+might make sense to replace the whole Django WSGI application with a custom one
+that later delegates to the Django one. For example, you could introduce WSGI
+middleware here, or combine a Django application with an application of another
+framework.
+
+"""
+
+import os
+import sys
+from pathlib import Path
+
+from django.core.wsgi import get_wsgi_application
+
+# This allows easy placement of apps within the interior
+# pyblackbird_cc directory.
+BASE_DIR = Path(__file__).resolve(strict=True).parent.parent
+sys.path.append(str(BASE_DIR / "pyblackbird_cc"))
+# We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks
+# if running multiple sites in the same mod_wsgi process. To fix this, use
+# mod_wsgi daemon mode with each site in its own daemon process, or use
+# os.environ["DJANGO_SETTINGS_MODULE"] = "config.settings.production"
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.production")
+
+# This application object is used by any WSGI server configured to use this
+# file. This includes Django's development server, if the WSGI_APPLICATION
+# setting points here.
+application = get_wsgi_application()
+# Apply WSGI middleware here.
+# from helloworld.wsgi import HelloWorldApplication
+# application = HelloWorldApplication(application)
diff --git a/docs.yml b/docs.yml
new file mode 100644
index 0000000..f7aa212
--- /dev/null
+++ b/docs.yml
@@ -0,0 +1,18 @@
+version: '3'
+
+services:
+ docs:
+ image: pyblackbird_cc_local_docs
+ container_name: pyblackbird_cc_local_docs
+ build:
+ context: .
+ dockerfile: ./compose/local/docs/Dockerfile
+ env_file:
+ - ./.envs/.local/.django
+ volumes:
+ - ./docs:/docs:z
+ - ./config:/app/config:z
+ - ./pyblackbird_cc:/app/pyblackbird_cc:z
+ ports:
+ - '9000:9000'
+ command: /start-docs
diff --git a/docs/Makefile b/docs/Makefile
new file mode 100644
index 0000000..6957700
--- /dev/null
+++ b/docs/Makefile
@@ -0,0 +1,29 @@
+# Minimal makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line, and also
+# from the environment for the first two.
+SPHINXOPTS ?=
+SPHINXBUILD ?= sphinx-build
+SOURCEDIR = .
+BUILDDIR = ./_build
+APP = /app
+
+.PHONY: help livehtml apidocs Makefile
+
+# Put it first so that "make" without argument is like "make help".
+help:
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -c .
+
+# Build, watch and serve docs with live reload
+livehtml:
+ sphinx-autobuild -b html --host 0.0.0.0 --port 9000 --watch $(APP) -c . $(SOURCEDIR) $(BUILDDIR)/html
+
+# Outputs rst files from django application code
+apidocs:
+ sphinx-apidoc -o $(SOURCEDIR)/api $(APP)
+
+# Catch-all target: route all unknown targets to Sphinx using the new
+# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
+%: Makefile
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -c .
diff --git a/docs/__init__.py b/docs/__init__.py
new file mode 100644
index 0000000..8772c82
--- /dev/null
+++ b/docs/__init__.py
@@ -0,0 +1 @@
+# Included so that Django's startproject comment runs against the docs directory
diff --git a/docs/conf.py b/docs/conf.py
new file mode 100644
index 0000000..3dc1bc6
--- /dev/null
+++ b/docs/conf.py
@@ -0,0 +1,64 @@
+# ruff: noqa
+# Configuration file for the Sphinx documentation builder.
+#
+# This file only contains a selection of the most common options. For a full
+# list see the documentation:
+# https://www.sphinx-doc.org/en/master/usage/configuration.html
+
+# -- Path setup --------------------------------------------------------------
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+
+import os
+import sys
+import django
+
+if os.getenv("READTHEDOCS", default=False) == "True":
+ sys.path.insert(0, os.path.abspath(".."))
+ os.environ["DJANGO_READ_DOT_ENV_FILE"] = "True"
+ os.environ["USE_DOCKER"] = "no"
+else:
+ sys.path.insert(0, os.path.abspath("/app"))
+os.environ["DATABASE_URL"] = "sqlite:///readthedocs.db"
+os.environ["CELERY_BROKER_URL"] = os.getenv("REDIS_URL", "redis://redis:6379")
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")
+django.setup()
+
+# -- Project information -----------------------------------------------------
+
+project = "pyblackbird-cc"
+copyright = """2024, Matthew Lemon"""
+author = "Matthew Lemon"
+
+
+# -- General configuration ---------------------------------------------------
+
+# Add any Sphinx extension module names here, as strings. They can be
+# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
+# ones.
+extensions = [
+ "sphinx.ext.autodoc",
+ "sphinx.ext.napoleon",
+]
+
+# Add any paths that contain templates here, relative to this directory.
+# templates_path = ["_templates"]
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+# This pattern also affects html_static_path and html_extra_path.
+exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
+
+# -- Options for HTML output -------------------------------------------------
+
+# The theme to use for HTML and HTML Help pages. See the documentation for
+# a list of builtin themes.
+#
+html_theme = "alabaster"
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+# html_static_path = ["_static"]
diff --git a/docs/howto.rst b/docs/howto.rst
new file mode 100644
index 0000000..73953de
--- /dev/null
+++ b/docs/howto.rst
@@ -0,0 +1,38 @@
+How To - Project Documentation
+======================================================================
+
+Get Started
+----------------------------------------------------------------------
+
+Documentation can be written as rst files in `pyblackbird_cc/docs`.
+
+
+To build and serve docs, use the commands::
+
+ docker compose -f local.yml up docs
+
+
+
+Changes to files in `docs/_source` will be picked up and reloaded automatically.
+
+`Sphinx <https://www.sphinx-doc.org/>`_ is the tool used to build documentation.
+
+Docstrings to Documentation
+----------------------------------------------------------------------
+
+The sphinx extension `apidoc <https://www.sphinx-doc.org/en/master/man/sphinx-apidoc.html>`_ is used to automatically document code using signatures and docstrings.
+
+Numpy or Google style docstrings will be picked up from project files and available for documentation. See the `Napoleon <https://sphinxcontrib-napoleon.readthedocs.io/en/latest/>`_ extension for details.
+
+For an in-use example, see the `page source <_sources/users.rst.txt>`_ for :ref:`users`.
+
+To compile all docstrings automatically into documentation source files, use the command:
+ ::
+
+ make apidocs
+
+
+This can be done in the docker container:
+ ::
+
+ docker run --rm docs make apidocs
diff --git a/docs/index.rst b/docs/index.rst
new file mode 100644
index 0000000..afb7889
--- /dev/null
+++ b/docs/index.rst
@@ -0,0 +1,24 @@
+.. pyblackbird-cc documentation master file, created by
+ sphinx-quickstart.
+ You can adapt this file completely to your liking, but it should at least
+ contain the root `toctree` directive.
+
+Welcome to pyblackbird-cc's documentation!
+======================================================================
+
+.. toctree::
+ :maxdepth: 2
+ :caption: Contents:
+
+ howto
+ pycharm/configuration
+ users
+
+
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
diff --git a/docs/make.bat b/docs/make.bat
new file mode 100644
index 0000000..27675c2
--- /dev/null
+++ b/docs/make.bat
@@ -0,0 +1,46 @@
+@ECHO OFF
+
+pushd %~dp0
+
+REM Command file for Sphinx documentation
+
+
+if "%SPHINXBUILD%" == "" (
+ set SPHINXBUILD=sphinx-build -c .
+)
+set SOURCEDIR=_source
+set BUILDDIR=_build
+set APP=..\pyblackbird_cc
+
+if "%1" == "" goto help
+
+%SPHINXBUILD% >NUL 2>NUL
+if errorlevel 9009 (
+ echo.
+ echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
+ echo.installed, then set the SPHINXBUILD environment variable to point
+ echo.to the full path of the 'sphinx-build' executable. Alternatively you
+ echo.may add the Sphinx directory to PATH.
+ echo.
+ echo.Install sphinx-autobuild for live serving.
+ echo.If you don't have Sphinx installed, grab it from
+ echo.http://sphinx-doc.org/
+ exit /b 1
+)
+
+%SPHINXBUILD% -b %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
+goto end
+
+:livehtml
+sphinx-autobuild -b html --open-browser -p 9000 --watch %APP% -c . %SOURCEDIR% %BUILDDIR%/html
+GOTO :EOF
+
+:apidocs
+sphinx-apidoc -o %SOURCEDIR%/api %APP%
+GOTO :EOF
+
+:help
+%SPHINXBUILD% -b help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
+
+:end
+popd
diff --git a/docs/pycharm/configuration.rst b/docs/pycharm/configuration.rst
new file mode 100644
index 0000000..fa53a8f
--- /dev/null
+++ b/docs/pycharm/configuration.rst
@@ -0,0 +1,70 @@
+Docker Remote Debugging
+=======================
+
+To connect to python remote interpreter inside docker, you have to make sure first, that Pycharm is aware of your docker.
+
+Go to *Settings > Build, Execution, Deployment > Docker*. If you are on linux, you can use docker directly using its socket `unix:///var/run/docker.sock`, if you are on Windows or Mac, make sure that you have docker-machine installed, then you can simply *Import credentials from Docker Machine*.
+
+.. image:: images/1.png
+
+Configure Remote Python Interpreter
+-----------------------------------
+
+This repository comes with already prepared "Run/Debug Configurations" for docker.
+
+.. image:: images/2.png
+
+But as you can see, at the beginning there is something wrong with them. They have red X on django icon, and they cannot be used, without configuring remote python interpreter. To do that, you have to go to *Settings > Build, Execution, Deployment* first.
+
+
+Next, you have to add new remote python interpreter, based on already tested deployment settings. Go to *Settings > Project > Project Interpreter*. Click on the cog icon, and click *Add Remote*.
+
+.. image:: images/3.png
+
+Switch to *Docker Compose* and select `local.yml` file from directory of your project, next set *Service name* to `django`
+
+.. image:: images/4.png
+
+Having that, click *OK*. Close *Settings* panel, and wait few seconds...
+
+.. image:: images/7.png
+
+After few seconds, all *Run/Debug Configurations* should be ready to use.
+
+.. image:: images/8.png
+
+**Things you can do with provided configuration**:
+
+* run and debug python code
+
+.. image:: images/f1.png
+
+* run and debug tests
+
+.. image:: images/f2.png
+.. image:: images/f3.png
+
+* run and debug migrations or different django management commands
+
+.. image:: images/f4.png
+
+* and many others..
+
+Known issues
+------------
+
+* Pycharm hangs on "Connecting to Debugger"
+
+.. image:: images/issue1.png
+
+This might be fault of your firewall. Take a look on this ticket - https://youtrack.jetbrains.com/issue/PY-18913
+
+* Modified files in `.idea` directory
+
+Most of the files from `.idea/` were added to `.gitignore` with a few exceptions, which were made, to provide "ready to go" configuration. After adding remote interpreter some of these files are altered by PyCharm:
+
+.. image:: images/issue2.png
+
+In theory you can remove them from repository, but then, other people will lose a ability to initialize a project from provided configurations as you did. To get rid of this annoying state, you can run command::
+
+ $ git update-index --assume-unchanged pyblackbird_cc.iml
diff --git a/docs/pycharm/images/1.png b/docs/pycharm/images/1.png
new file mode 100644
index 0000000..06908a1
--- /dev/null
+++ b/docs/pycharm/images/1.png
Binary files differ
diff --git a/docs/pycharm/images/2.png b/docs/pycharm/images/2.png
new file mode 100644
index 0000000..1fb8cf1
--- /dev/null
+++ b/docs/pycharm/images/2.png
Binary files differ
diff --git a/docs/pycharm/images/3.png b/docs/pycharm/images/3.png
new file mode 100644
index 0000000..32c9335
--- /dev/null
+++ b/docs/pycharm/images/3.png
Binary files differ
diff --git a/docs/pycharm/images/4.png b/docs/pycharm/images/4.png
new file mode 100644
index 0000000..cf07f9d
--- /dev/null
+++ b/docs/pycharm/images/4.png
Binary files differ
diff --git a/docs/pycharm/images/7.png b/docs/pycharm/images/7.png
new file mode 100644
index 0000000..4f8807e
--- /dev/null
+++ b/docs/pycharm/images/7.png
Binary files differ
diff --git a/docs/pycharm/images/8.png b/docs/pycharm/images/8.png
new file mode 100644
index 0000000..05946f2
--- /dev/null
+++ b/docs/pycharm/images/8.png
Binary files differ
diff --git a/docs/pycharm/images/f1.png b/docs/pycharm/images/f1.png
new file mode 100644
index 0000000..2d8c4b6
--- /dev/null
+++ b/docs/pycharm/images/f1.png
Binary files differ
diff --git a/docs/pycharm/images/f2.png b/docs/pycharm/images/f2.png
new file mode 100644
index 0000000..b123a47
--- /dev/null
+++ b/docs/pycharm/images/f2.png
Binary files differ
diff --git a/docs/pycharm/images/f3.png b/docs/pycharm/images/f3.png
new file mode 100644
index 0000000..713ab54
--- /dev/null
+++ b/docs/pycharm/images/f3.png
Binary files differ
diff --git a/docs/pycharm/images/f4.png b/docs/pycharm/images/f4.png
new file mode 100644
index 0000000..11668ec
--- /dev/null
+++ b/docs/pycharm/images/f4.png
Binary files differ
diff --git a/docs/pycharm/images/issue1.png b/docs/pycharm/images/issue1.png
new file mode 100644
index 0000000..1bb68ee
--- /dev/null
+++ b/docs/pycharm/images/issue1.png
Binary files differ
diff --git a/docs/pycharm/images/issue2.png b/docs/pycharm/images/issue2.png
new file mode 100644
index 0000000..174f6fd
--- /dev/null
+++ b/docs/pycharm/images/issue2.png
Binary files differ
diff --git a/docs/users.rst b/docs/users.rst
new file mode 100644
index 0000000..1ddbc73
--- /dev/null
+++ b/docs/users.rst
@@ -0,0 +1,15 @@
+ .. _users:
+
+Users
+======================================================================
+
+Starting a new project, it’s highly recommended to set up a custom user model,
+even if the default User model is sufficient for you.
+
+This model behaves identically to the default user model,
+but you’ll be able to customize it in the future if the need arises.
+
+.. automodule:: pyblackbird_cc.users.models
+ :members:
+ :noindex:
+
diff --git a/local.yml b/local.yml
new file mode 100644
index 0000000..205942a
--- /dev/null
+++ b/local.yml
@@ -0,0 +1,75 @@
+volumes:
+ pyblackbird_cc_local_postgres_data: {}
+ pyblackbird_cc_local_postgres_data_backups: {}
+
+services:
+ django: &django
+ build:
+ context: .
+ dockerfile: ./compose/local/django/Dockerfile
+ image: pyblackbird_cc_local_django
+ container_name: pyblackbird_cc_local_django
+ depends_on:
+ - postgres
+ - redis
+ - mailpit
+ volumes:
+ - .:/app:z
+ env_file:
+ - ./.envs/.local/.django
+ - ./.envs/.local/.postgres
+ ports:
+ - '8000:8000'
+ command: /start
+
+ postgres:
+ build:
+ context: .
+ dockerfile: ./compose/production/postgres/Dockerfile
+ image: pyblackbird_cc_production_postgres
+ container_name: pyblackbird_cc_local_postgres
+ volumes:
+ - pyblackbird_cc_local_postgres_data:/var/lib/postgresql/data
+ - pyblackbird_cc_local_postgres_data_backups:/backups
+ env_file:
+ - ./.envs/.local/.postgres
+
+ mailpit:
+ image: docker.io/axllent/mailpit:latest
+ container_name: pyblackbird_cc_local_mailpit
+ ports:
+ - "8025:8025"
+
+ redis:
+ image: docker.io/redis:6
+ container_name: pyblackbird_cc_local_redis
+
+ celeryworker:
+ <<: *django
+ image: pyblackbird_cc_local_celeryworker
+ container_name: pyblackbird_cc_local_celeryworker
+ depends_on:
+ - redis
+ - postgres
+ - mailpit
+ ports: []
+ command: /start-celeryworker
+
+ celerybeat:
+ <<: *django
+ image: pyblackbird_cc_local_celerybeat
+ container_name: pyblackbird_cc_local_celerybeat
+ depends_on:
+ - redis
+ - postgres
+ - mailpit
+ ports: []
+ command: /start-celerybeat
+
+ flower:
+ <<: *django
+ image: pyblackbird_cc_local_flower
+ container_name: pyblackbird_cc_local_flower
+ ports:
+ - '5555:5555'
+ command: /start-flower
diff --git a/locale/README.md b/locale/README.md
new file mode 100644
index 0000000..9911fec
--- /dev/null
+++ b/locale/README.md
@@ -0,0 +1,32 @@
+# Translations
+
+Start by configuring the `LANGUAGES` settings in `base.py`, by uncommenting languages you are willing to support. Then, translations strings will be placed in this folder when running:
+
+```bash
+docker compose -f local.yml run --rm django python manage.py makemessages -all --no-location
+```
+
+This should generate `django.po` (stands for Portable Object) files under each locale `<locale name>/LC_MESSAGES/django.po`. Each translatable string in the codebase is collected with its `msgid` and need to be translated as `msgstr`, for example:
+
+```po
+msgid "users"
+msgstr "utilisateurs"
+```
+
+Once all translations are done, they need to be compiled into `.mo` files (stands for Machine Object), which are the actual binary files used by the application:
+
+```bash
+docker compose -f local.yml run --rm django python manage.py compilemessages
+```
+
+Note that the `.po` files are NOT used by the application directly, so if the `.mo` files are out of dates, the content won't appear as translated even if the `.po` files are up-to-date.
+
+## Production
+
+The production image runs `compilemessages` automatically at build time, so as long as your translated source files (PO) are up-to-date, you're good to go.
+
+## Add a new language
+
+1. Update the [`LANGUAGES` setting](https://docs.djangoproject.com/en/stable/ref/settings/#std-setting-LANGUAGES) to your project's base settings.
+2. Create the locale folder for the language next to this file, e.g. `fr_FR` for French. Make sure the case is correct.
+3. Run `makemessages` (as instructed above) to generate the PO files for the new language.
diff --git a/locale/en_US/LC_MESSAGES/django.po b/locale/en_US/LC_MESSAGES/django.po
new file mode 100644
index 0000000..5730dc9
--- /dev/null
+++ b/locale/en_US/LC_MESSAGES/django.po
@@ -0,0 +1,12 @@
+# Translations for the pyblackbird-cc project
+# Copyright (C) 2024 Matthew Lemon
+# Matthew Lemon <y@yulqen.org>, 2024.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: 0.1.0\n"
+"Language: en-US\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
diff --git a/locale/fr_FR/LC_MESSAGES/django.po b/locale/fr_FR/LC_MESSAGES/django.po
new file mode 100644
index 0000000..51c6fde
--- /dev/null
+++ b/locale/fr_FR/LC_MESSAGES/django.po
@@ -0,0 +1,335 @@
+# Translations for the pyblackbird-cc project
+# Copyright (C) 2024 Matthew Lemon
+# Matthew Lemon <y@yulqen.org>, 2024.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: 0.1.0\n"
+"Language: fr-FR\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n > 1);\n"
+#: pyblackbird_cc/templates/account/account_inactive.html:5
+#: pyblackbird_cc/templates/account/account_inactive.html:8
+msgid "Account Inactive"
+msgstr "Compte inactif"
+
+#: pyblackbird_cc/templates/account/account_inactive.html:10
+msgid "This account is inactive."
+msgstr "Ce compte est inactif."
+
+#: pyblackbird_cc/templates/account/email.html:7
+msgid "Account"
+msgstr "Compte"
+
+#: pyblackbird_cc/templates/account/email.html:10
+msgid "E-mail Addresses"
+msgstr "Adresses e-mail"
+
+#: pyblackbird_cc/templates/account/email.html:13
+msgid "The following e-mail addresses are associated with your account:"
+msgstr "Les adresses e-mail suivantes sont associées à votre compte :"
+
+#: pyblackbird_cc/templates/account/email.html:27
+msgid "Verified"
+msgstr "Vérifié"
+
+#: pyblackbird_cc/templates/account/email.html:29
+msgid "Unverified"
+msgstr "Non vérifié"
+
+#: pyblackbird_cc/templates/account/email.html:31
+msgid "Primary"
+msgstr "Primaire"
+
+#: pyblackbird_cc/templates/account/email.html:37
+msgid "Make Primary"
+msgstr "Changer Primaire"
+
+#: pyblackbird_cc/templates/account/email.html:38
+msgid "Re-send Verification"
+msgstr "Renvoyer vérification"
+
+#: pyblackbird_cc/templates/account/email.html:39
+msgid "Remove"
+msgstr "Supprimer"
+
+#: pyblackbird_cc/templates/account/email.html:46
+msgid "Warning:"
+msgstr "Avertissement:"
+
+#: pyblackbird_cc/templates/account/email.html:46
+msgid ""
+"You currently do not have any e-mail address set up. You should really add "
+"an e-mail address so you can receive notifications, reset your password, etc."
+msgstr ""
+"Vous n'avez actuellement aucune adresse e-mail configurée. Vous devriez ajouter "
+"une adresse e-mail pour reçevoir des notifications, réinitialiser votre mot "
+"de passe, etc."
+
+#: pyblackbird_cc/templates/account/email.html:51
+msgid "Add E-mail Address"
+msgstr "Ajouter une adresse e-mail"
+
+#: pyblackbird_cc/templates/account/email.html:56
+msgid "Add E-mail"
+msgstr "Ajouter e-mail"
+
+#: pyblackbird_cc/templates/account/email.html:66
+msgid "Do you really want to remove the selected e-mail address?"
+msgstr "Voulez-vous vraiment supprimer l'adresse e-mail sélectionnée ?"
+
+#: pyblackbird_cc/templates/account/email_confirm.html:6
+#: pyblackbird_cc/templates/account/email_confirm.html:10
+msgid "Confirm E-mail Address"
+msgstr "Confirmez votre adresse email"
+
+#: pyblackbird_cc/templates/account/email_confirm.html:16
+#, python-format
+msgid ""
+"Please confirm that <a href=\"mailto:%(email)s\">%(email)s</a> is an e-mail "
+"address for user %(user_display)s."
+msgstr ""
+"Veuillez confirmer que <a href=\"mailto:%(email)s\">%(email)s</a> est un e-mail "
+"adresse de l'utilisateur %(user_display)s."
+
+#: pyblackbird_cc/templates/account/email_confirm.html:20
+msgid "Confirm"
+msgstr "Confirm"
+
+#: pyblackbird_cc/templates/account/email_confirm.html:27
+#, python-format
+msgid ""
+"This e-mail confirmation link expired or is invalid. Please <a href="
+"\"%(email_url)s\">issue a new e-mail confirmation request</a>."
+msgstr ""
+"Ce lien de confirmation par e-mail a expiré ou n'est pas valide. Veuillez"
+ "<a href=\"%(email_url)s\">émettre une nouvelle demande de confirmation "
+"par e-mail</a>."
+
+#: pyblackbird_cc/templates/account/login.html:7
+#: pyblackbird_cc/templates/account/login.html:11
+#: pyblackbird_cc/templates/account/login.html:56
+#: pyblackbird_cc/templates/base.html:72
+msgid "Sign In"
+msgstr "S'identifier"
+
+#: pyblackbird_cc/templates/account/login.html:17
+msgid "Please sign in with one of your existing third party accounts:"
+msgstr "Veuillez vous connecter avec l'un de vos comptes tiers existants :"
+
+#: pyblackbird_cc/templates/account/login.html:19
+#, python-format
+msgid ""
+"Or, <a href=\"%(signup_url)s\">sign up</a> for a %(site_name)s account and "
+"sign in below:"
+msgstr ""
+"Ou, <a href=\"%(signup_url)s\">créez</a> un compte %(site_name)s et "
+"connectez-vous ci-dessous :"
+
+#: pyblackbird_cc/templates/account/login.html:32
+msgid "or"
+msgstr "ou"
+
+#: pyblackbird_cc/templates/account/login.html:41
+#, python-format
+msgid ""
+"If you have not created an account yet, then please <a href=\"%(signup_url)s"
+"\">sign up</a> first."
+msgstr ""
+"Si vous n'avez pas encore créé de compte, veuillez d'abord <a href=\"%(signup_url)s"
+"\">vous inscrire</a>."
+
+#: pyblackbird_cc/templates/account/login.html:55
+msgid "Forgot Password?"
+msgstr "Mot de passe oublié?"
+
+#: pyblackbird_cc/templates/account/logout.html:5
+#: pyblackbird_cc/templates/account/logout.html:8
+#: pyblackbird_cc/templates/account/logout.html:17
+#: pyblackbird_cc/templates/base.html:61
+msgid "Sign Out"
+msgstr "Se déconnecter"
+
+#: pyblackbird_cc/templates/account/logout.html:10
+msgid "Are you sure you want to sign out?"
+msgstr "Êtes-vous certain de vouloir vous déconnecter?"
+
+#: pyblackbird_cc/templates/account/password_change.html:6
+#: pyblackbird_cc/templates/account/password_change.html:9
+#: pyblackbird_cc/templates/account/password_change.html:14
+#: pyblackbird_cc/templates/account/password_reset_from_key.html:5
+#: pyblackbird_cc/templates/account/password_reset_from_key.html:8
+#: pyblackbird_cc/templates/account/password_reset_from_key_done.html:4
+#: pyblackbird_cc/templates/account/password_reset_from_key_done.html:7
+msgid "Change Password"
+msgstr "Changer le mot de passe"
+
+#: pyblackbird_cc/templates/account/password_reset.html:7
+#: pyblackbird_cc/templates/account/password_reset.html:11
+#: pyblackbird_cc/templates/account/password_reset_done.html:6
+#: pyblackbird_cc/templates/account/password_reset_done.html:9
+msgid "Password Reset"
+msgstr "Réinitialisation du mot de passe"
+
+#: pyblackbird_cc/templates/account/password_reset.html:16
+msgid ""
+"Forgotten your password? Enter your e-mail address below, and we'll send you "
+"an e-mail allowing you to reset it."
+msgstr ""
+"Mot de passe oublié? Entrez votre adresse e-mail ci-dessous, et nous vous "
+"enverrons un e-mail vous permettant de le réinitialiser."
+
+#: pyblackbird_cc/templates/account/password_reset.html:21
+msgid "Reset My Password"
+msgstr "Réinitialiser mon mot de passe"
+
+#: pyblackbird_cc/templates/account/password_reset.html:24
+msgid "Please contact us if you have any trouble resetting your password."
+msgstr ""
+"Veuillez nous contacter si vous rencontrez des difficultés pour réinitialiser"
+"votre mot de passe."
+
+#: pyblackbird_cc/templates/account/password_reset_done.html:15
+msgid ""
+"We have sent you an e-mail. Please contact us if you do not receive it "
+"within a few minutes."
+msgstr ""
+"Nous vous avons envoyé un e-mail. Veuillez nous contacter si vous ne le "
+"recevez pas d'ici quelques minutes."
+
+#: pyblackbird_cc/templates/account/password_reset_from_key.html:8
+msgid "Bad Token"
+msgstr "Token Invalide"
+
+#: pyblackbird_cc/templates/account/password_reset_from_key.html:12
+#, python-format
+msgid ""
+"The password reset link was invalid, possibly because it has already been "
+"used. Please request a <a href=\"%(passwd_reset_url)s\">new password reset</"
+"a>."
+msgstr ""
+"Le lien de réinitialisation du mot de passe n'était pas valide, peut-être parce "
+"qu'il a déjà été utilisé. Veuillez faire une <a href=\"%(passwd_reset_url)s\"> "
+"nouvelle demande de réinitialisation de mot de passe</a>."
+
+#: pyblackbird_cc/templates/account/password_reset_from_key.html:18
+msgid "change password"
+msgstr "changer le mot de passe"
+
+#: pyblackbird_cc/templates/account/password_reset_from_key.html:21
+#: pyblackbird_cc/templates/account/password_reset_from_key_done.html:8
+msgid "Your password is now changed."
+msgstr "Votre mot de passe est maintenant modifié."
+
+#: pyblackbird_cc/templates/account/password_set.html:6
+#: pyblackbird_cc/templates/account/password_set.html:9
+#: pyblackbird_cc/templates/account/password_set.html:14
+msgid "Set Password"
+msgstr "Définir le mot de passe"
+
+#: pyblackbird_cc/templates/account/signup.html:6
+msgid "Signup"
+msgstr "S'inscrire"
+
+#: pyblackbird_cc/templates/account/signup.html:9
+#: pyblackbird_cc/templates/account/signup.html:19
+#: pyblackbird_cc/templates/base.html:67
+msgid "Sign Up"
+msgstr "S'inscrire"
+
+#: pyblackbird_cc/templates/account/signup.html:11
+#, python-format
+msgid ""
+"Already have an account? Then please <a href=\"%(login_url)s\">sign in</a>."
+msgstr ""
+"Vous avez déjà un compte? Alors veuillez <a href=\"%(login_url)s\">vous connecter</a>."
+
+#: pyblackbird_cc/templates/account/signup_closed.html:5
+#: pyblackbird_cc/templates/account/signup_closed.html:8
+msgid "Sign Up Closed"
+msgstr "Inscriptions closes"
+
+#: pyblackbird_cc/templates/account/signup_closed.html:10
+msgid "We are sorry, but the sign up is currently closed."
+msgstr "Désolé, mais l'inscription est actuellement fermée."
+
+#: pyblackbird_cc/templates/account/verification_sent.html:5
+#: pyblackbird_cc/templates/account/verification_sent.html:8
+#: pyblackbird_cc/templates/account/verified_email_required.html:5
+#: pyblackbird_cc/templates/account/verified_email_required.html:8
+msgid "Verify Your E-mail Address"
+msgstr "Vérifiez votre adresse e-mail"
+
+#: pyblackbird_cc/templates/account/verification_sent.html:10
+msgid ""
+"We have sent an e-mail to you for verification. Follow the link provided to "
+"finalize the signup process. Please contact us if you do not receive it "
+"within a few minutes."
+msgstr "Nous vous avons envoyé un e-mail pour vérification. Suivez le lien fourni "
+"pour finalisez le processus d'inscription. Veuillez nous contacter si vous ne le "
+"recevez pas d'ici quelques minutes."
+
+#: pyblackbird_cc/templates/account/verified_email_required.html:12
+msgid ""
+"This part of the site requires us to verify that\n"
+"you are who you claim to be. For this purpose, we require that you\n"
+"verify ownership of your e-mail address. "
+msgstr ""
+"Cette partie du site nous oblige à vérifier que\n"
+"vous êtes qui vous prétendez être. Nous vous demandons donc de\n"
+"vérifier la propriété de votre adresse e-mail."
+
+#: pyblackbird_cc/templates/account/verified_email_required.html:16
+msgid ""
+"We have sent an e-mail to you for\n"
+"verification. Please click on the link inside this e-mail. Please\n"
+"contact us if you do not receive it within a few minutes."
+msgstr ""
+"Nous vous avons envoyé un e-mail pour\n"
+"vérification. Veuillez cliquer sur le lien contenu dans cet e-mail. Veuillez nous\n"
+"contacter si vous ne le recevez pas d'ici quelques minutes."
+
+#: pyblackbird_cc/templates/account/verified_email_required.html:20
+#, python-format
+msgid ""
+"<strong>Note:</strong> you can still <a href=\"%(email_url)s\">change your e-"
+"mail address</a>."
+msgstr ""
+"<strong>Remarque :</strong> vous pouvez toujours <a href=\"%(email_url)s\">changer votre e-"
+"adresse e-mail</a>."
+
+#: pyblackbird_cc/templates/base.html:57
+msgid "My Profile"
+msgstr "Mon Profil"
+
+#: pyblackbird_cc/users/admin.py:17
+msgid "Personal info"
+msgstr "Personal info"
+
+#: pyblackbird_cc/users/admin.py:19
+msgid "Permissions"
+msgstr "Permissions"
+
+#: pyblackbird_cc/users/admin.py:30
+msgid "Important dates"
+msgstr "Dates importantes"
+
+#: pyblackbird_cc/users/apps.py:7
+msgid "Users"
+msgstr "Utilisateurs"
+
+#: pyblackbird_cc/users/forms.py:24
+#: pyblackbird_cc/users/tests/test_forms.py:36
+msgid "This username has already been taken."
+msgstr "Ce nom d'utilisateur est déjà pris."
+
+#: pyblackbird_cc/users/models.py:15
+msgid "Name of User"
+msgstr "Nom de l'utilisateur"
+
+#: pyblackbird_cc/users/views.py:23
+msgid "Information successfully updated"
+msgstr "Informations mises à jour avec succès"
diff --git a/locale/pt_BR/LC_MESSAGES/django.po b/locale/pt_BR/LC_MESSAGES/django.po
new file mode 100644
index 0000000..075deda
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/django.po
@@ -0,0 +1,315 @@
+# Translations for the pyblackbird-cc project
+# Copyright (C) 2024 Matthew Lemon
+# Matthew Lemon <y@yulqen.org>, 2024.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: 0.1.0\n"
+"Language: pt-BR\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n > 1);\n"
+#: pyblackbird_cc/templates/account/account_inactive.html:5
+#: pyblackbird_cc/templates/account/account_inactive.html:8
+msgid "Account Inactive"
+msgstr "Conta Inativa"
+
+#: pyblackbird_cc/templates/account/account_inactive.html:10
+msgid "This account is inactive."
+msgstr "Esta conta está inativa."
+
+#: pyblackbird_cc/templates/account/email.html:7
+msgid "Account"
+msgstr "Conta"
+
+#: pyblackbird_cc/templates/account/email.html:10
+msgid "E-mail Addresses"
+msgstr "Endereços de E-mail"
+
+#: pyblackbird_cc/templates/account/email.html:13
+msgid "The following e-mail addresses are associated with your account:"
+msgstr "Os seguintes endereços de e-mail estão associados à sua conta:"
+
+#: pyblackbird_cc/templates/account/email.html:27
+msgid "Verified"
+msgstr "Verificado"
+
+#: pyblackbird_cc/templates/account/email.html:29
+msgid "Unverified"
+msgstr "Não verificado"
+
+#: pyblackbird_cc/templates/account/email.html:31
+msgid "Primary"
+msgstr "Primário"
+
+#: pyblackbird_cc/templates/account/email.html:37
+msgid "Make Primary"
+msgstr "Tornar Primário"
+
+#: pyblackbird_cc/templates/account/email.html:38
+msgid "Re-send Verification"
+msgstr "Reenviar verificação"
+
+#: pyblackbird_cc/templates/account/email.html:39
+msgid "Remove"
+msgstr "Remover"
+
+#: pyblackbird_cc/templates/account/email.html:46
+msgid "Warning:"
+msgstr "Aviso:"
+
+#: pyblackbird_cc/templates/account/email.html:46
+msgid ""
+"You currently do not have any e-mail address set up. You should really add "
+"an e-mail address so you can receive notifications, reset your password, etc."
+msgstr ""
+"No momento, você não tem nenhum endereço de e-mail configurado. Você "
+"realmente deve adicionar um endereço de e-mail para receber notificações, "
+"redefinir sua senha etc."
+
+#: pyblackbird_cc/templates/account/email.html:51
+msgid "Add E-mail Address"
+msgstr "Adicionar Endereço de E-mail"
+
+#: pyblackbird_cc/templates/account/email.html:56
+msgid "Add E-mail"
+msgstr "Adicionar E-mail"
+
+#: pyblackbird_cc/templates/account/email.html:66
+msgid "Do you really want to remove the selected e-mail address?"
+msgstr "Você realmente deseja remover o endereço de e-mail selecionado?"
+
+#: pyblackbird_cc/templates/account/email_confirm.html:6
+#: pyblackbird_cc/templates/account/email_confirm.html:10
+msgid "Confirm E-mail Address"
+msgstr "Confirme o endereço de e-mail"
+
+#: pyblackbird_cc/templates/account/email_confirm.html:16
+#, python-format
+msgid ""
+"Please confirm that <a href=\"mailto:%(email)s\">%(email)s</a> is an e-mail "
+"address for user %(user_display)s."
+msgstr ""
+"Confirme se <a href=\"mailto:%(email)s\">%(email)s</a> é um endereço de "
+"e-mail do usuário %(user_display)s."
+
+#: pyblackbird_cc/templates/account/email_confirm.html:20
+msgid "Confirm"
+msgstr "Confirmar"
+
+#: pyblackbird_cc/templates/account/email_confirm.html:27
+#, python-format
+msgid ""
+"This e-mail confirmation link expired or is invalid. Please <a href="
+"\"%(email_url)s\">issue a new e-mail confirmation request</a>."
+msgstr "Este link de confirmação de e-mail expirou ou é inválido. "
+"Por favor, <a href=\"%(email_url)s\">emita um novo pedido de confirmação por e-mail</a>."
+
+#: pyblackbird_cc/templates/account/login.html:7
+#: pyblackbird_cc/templates/account/login.html:11
+#: pyblackbird_cc/templates/account/login.html:56
+#: pyblackbird_cc/templates/base.html:72
+msgid "Sign In"
+msgstr "Entrar"
+
+#: pyblackbird_cc/templates/account/login.html:17
+msgid "Please sign in with one of your existing third party accounts:"
+msgstr "Faça login com uma de suas contas de terceiros existentes:"
+
+#: pyblackbird_cc/templates/account/login.html:19
+#, python-format
+msgid ""
+"Or, <a href=\"%(signup_url)s\">sign up</a> for a %(site_name)s account and "
+"sign in below:"
+msgstr "Ou, <a href=\"%(signup_url)s\">cadastre-se</a> para uma conta em %(site_name)s e entre abaixo:"
+
+#: pyblackbird_cc/templates/account/login.html:32
+msgid "or"
+msgstr "ou"
+
+#: pyblackbird_cc/templates/account/login.html:41
+#, python-format
+msgid ""
+"If you have not created an account yet, then please <a href=\"%(signup_url)s"
+"\">sign up</a> first."
+msgstr "Se você ainda não criou uma conta, <a href=\"%(signup_url)s"
+"\">registre-se primeiro</a>."
+
+#: pyblackbird_cc/templates/account/login.html:55
+msgid "Forgot Password?"
+msgstr "Esqueceu sua senha?"
+
+#: pyblackbird_cc/templates/account/logout.html:5
+#: pyblackbird_cc/templates/account/logout.html:8
+#: pyblackbird_cc/templates/account/logout.html:17
+#: pyblackbird_cc/templates/base.html:61
+msgid "Sign Out"
+msgstr "Sair"
+
+#: pyblackbird_cc/templates/account/logout.html:10
+msgid "Are you sure you want to sign out?"
+msgstr "Você tem certeza que deseja sair?"
+
+#: pyblackbird_cc/templates/account/password_change.html:6
+#: pyblackbird_cc/templates/account/password_change.html:9
+#: pyblackbird_cc/templates/account/password_change.html:14
+#: pyblackbird_cc/templates/account/password_reset_from_key.html:5
+#: pyblackbird_cc/templates/account/password_reset_from_key.html:8
+#: pyblackbird_cc/templates/account/password_reset_from_key_done.html:4
+#: pyblackbird_cc/templates/account/password_reset_from_key_done.html:7
+msgid "Change Password"
+msgstr "Alterar Senha"
+
+#: pyblackbird_cc/templates/account/password_reset.html:7
+#: pyblackbird_cc/templates/account/password_reset.html:11
+#: pyblackbird_cc/templates/account/password_reset_done.html:6
+#: pyblackbird_cc/templates/account/password_reset_done.html:9
+msgid "Password Reset"
+msgstr "Redefinição de senha"
+
+#: pyblackbird_cc/templates/account/password_reset.html:16
+msgid ""
+"Forgotten your password? Enter your e-mail address below, and we'll send you "
+"an e-mail allowing you to reset it."
+msgstr "Esqueceu sua senha? Digite seu endereço de e-mail abaixo e enviaremos um e-mail permitindo que você o redefina."
+
+#: pyblackbird_cc/templates/account/password_reset.html:21
+msgid "Reset My Password"
+msgstr "Redefinir minha senha"
+
+#: pyblackbird_cc/templates/account/password_reset.html:24
+msgid "Please contact us if you have any trouble resetting your password."
+msgstr "Entre em contato conosco se tiver algum problema para redefinir sua senha."
+
+#: pyblackbird_cc/templates/account/password_reset_done.html:15
+msgid ""
+"We have sent you an e-mail. Please contact us if you do not receive it "
+"within a few minutes."
+msgstr "Enviamos um e-mail para você. Entre em contato conosco se você não recebê-lo dentro de alguns minutos."
+
+#: pyblackbird_cc/templates/account/password_reset_from_key.html:8
+msgid "Bad Token"
+msgstr "Token Inválido"
+
+#: pyblackbird_cc/templates/account/password_reset_from_key.html:12
+#, python-format
+msgid ""
+"The password reset link was invalid, possibly because it has already been "
+"used. Please request a <a href=\"%(passwd_reset_url)s\">new password reset</"
+"a>."
+msgstr "O link de redefinição de senha era inválido, possivelmente porque já foi usado. "
+"<a href=\"%(passwd_reset_url)s\">Solicite uma nova redefinição de senha</a>."
+
+#: pyblackbird_cc/templates/account/password_reset_from_key.html:18
+msgid "change password"
+msgstr "alterar senha"
+
+#: pyblackbird_cc/templates/account/password_reset_from_key.html:21
+#: pyblackbird_cc/templates/account/password_reset_from_key_done.html:8
+msgid "Your password is now changed."
+msgstr "Sua senha agora foi alterada."
+
+#: pyblackbird_cc/templates/account/password_set.html:6
+#: pyblackbird_cc/templates/account/password_set.html:9
+#: pyblackbird_cc/templates/account/password_set.html:14
+msgid "Set Password"
+msgstr "Definir Senha"
+
+#: pyblackbird_cc/templates/account/signup.html:6
+msgid "Signup"
+msgstr "Cadastro"
+
+#: pyblackbird_cc/templates/account/signup.html:9
+#: pyblackbird_cc/templates/account/signup.html:19
+#: pyblackbird_cc/templates/base.html:67
+msgid "Sign Up"
+msgstr "Cadastro"
+
+#: pyblackbird_cc/templates/account/signup.html:11
+#, python-format
+msgid ""
+"Already have an account? Then please <a href=\"%(login_url)s\">sign in</a>."
+msgstr "já tem uma conta? Então, por favor, faça <a href=\"%(login_url)s\">login</a>."
+
+#: pyblackbird_cc/templates/account/signup_closed.html:5
+#: pyblackbird_cc/templates/account/signup_closed.html:8
+msgid "Sign Up Closed"
+msgstr "Inscrições encerradas"
+
+#: pyblackbird_cc/templates/account/signup_closed.html:10
+msgid "We are sorry, but the sign up is currently closed."
+msgstr "Lamentamos, mas as inscrições estão encerradas no momento."
+
+#: pyblackbird_cc/templates/account/verification_sent.html:5
+#: pyblackbird_cc/templates/account/verification_sent.html:8
+#: pyblackbird_cc/templates/account/verified_email_required.html:5
+#: pyblackbird_cc/templates/account/verified_email_required.html:8
+msgid "Verify Your E-mail Address"
+msgstr "Verifique seu endereço de e-mail"
+
+#: pyblackbird_cc/templates/account/verification_sent.html:10
+msgid ""
+"We have sent an e-mail to you for verification. Follow the link provided to "
+"finalize the signup process. Please contact us if you do not receive it "
+"within a few minutes."
+msgstr "Enviamos um e-mail para você para verificação. Siga o link fornecido para finalizar o processo de inscrição. Entre em contato conosco se você não recebê-lo dentro de alguns minutos."
+
+#: pyblackbird_cc/templates/account/verified_email_required.html:12
+msgid ""
+"This part of the site requires us to verify that\n"
+"you are who you claim to be. For this purpose, we require that you\n"
+"verify ownership of your e-mail address. "
+msgstr "Esta parte do site exige que verifiquemos se você é quem afirma ser.\n"
+"Para esse fim, exigimos que você verifique a propriedade\n"
+"do seu endereço de e-mail."
+
+#: pyblackbird_cc/templates/account/verified_email_required.html:16
+msgid ""
+"We have sent an e-mail to you for\n"
+"verification. Please click on the link inside this e-mail. Please\n"
+"contact us if you do not receive it within a few minutes."
+msgstr "Enviamos um e-mail para você para verificação.\n"
+"Por favor, clique no link dentro deste e-mail.\n"
+"Entre em contato conosco se você não recebê-lo dentro de alguns minutos."
+
+#: pyblackbird_cc/templates/account/verified_email_required.html:20
+#, python-format
+msgid ""
+"<strong>Note:</strong> you can still <a href=\"%(email_url)s\">change your e-"
+"mail address</a>."
+msgstr "<strong>Nota</strong>: você ainda pode <a href=\"%(email_url)s\">alterar seu endereço de e-mail</a>."
+
+#: pyblackbird_cc/templates/base.html:57
+msgid "My Profile"
+msgstr "Meu perfil"
+
+#: pyblackbird_cc/users/admin.py:17
+msgid "Personal info"
+msgstr "Informação pessoal"
+
+#: pyblackbird_cc/users/admin.py:19
+msgid "Permissions"
+msgstr "Permissões"
+
+#: pyblackbird_cc/users/admin.py:30
+msgid "Important dates"
+msgstr "Datas importantes"
+
+#: pyblackbird_cc/users/apps.py:7
+msgid "Users"
+msgstr "Usuários"
+
+#: pyblackbird_cc/users/forms.py:24
+#: pyblackbird_cc/users/tests/test_forms.py:36
+msgid "This username has already been taken."
+msgstr "Este nome de usuário já foi usado."
+
+#: pyblackbird_cc/users/models.py:15
+msgid "Name of User"
+msgstr "Nome do Usuário"
+
+#: pyblackbird_cc/users/views.py:23
+msgid "Information successfully updated"
+msgstr "Informação atualizada com sucesso"
diff --git a/manage.py b/manage.py
new file mode 100755
index 0000000..c84a3bc
--- /dev/null
+++ b/manage.py
@@ -0,0 +1,32 @@
+#!/usr/bin/env python
+# ruff: noqa
+import os
+import sys
+from pathlib import Path
+
+if __name__ == "__main__":
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")
+
+ try:
+ from django.core.management import execute_from_command_line
+ except ImportError:
+ # The above import may fail for some other reason. Ensure that the
+ # issue is really that Django is missing to avoid masking other
+ # exceptions on Python 2.
+ try:
+ import django
+ except ImportError:
+ raise ImportError(
+ "Couldn't import Django. Are you sure it's installed and "
+ "available on your PYTHONPATH environment variable? Did you "
+ "forget to activate a virtual environment?"
+ )
+
+ raise
+
+ # This allows easy placement of apps within the interior
+ # pyblackbird_cc directory.
+ current_path = Path(__file__).parent.resolve()
+ sys.path.append(str(current_path / "pyblackbird_cc"))
+
+ execute_from_command_line(sys.argv)
diff --git a/merge_production_dotenvs_in_dotenv.py b/merge_production_dotenvs_in_dotenv.py
new file mode 100644
index 0000000..c83ed71
--- /dev/null
+++ b/merge_production_dotenvs_in_dotenv.py
@@ -0,0 +1,27 @@
+# ruff: noqa
+import os
+from collections.abc import Sequence
+from pathlib import Path
+
+BASE_DIR = Path(__file__).parent.resolve()
+PRODUCTION_DOTENVS_DIR = BASE_DIR / ".envs" / ".production"
+PRODUCTION_DOTENV_FILES = [
+ PRODUCTION_DOTENVS_DIR / ".django",
+ PRODUCTION_DOTENVS_DIR / ".postgres",
+]
+DOTENV_FILE = BASE_DIR / ".env"
+
+
+def merge(
+ output_file: Path,
+ files_to_merge: Sequence[Path],
+) -> None:
+ merged_content = ""
+ for merge_file in files_to_merge:
+ merged_content += merge_file.read_text()
+ merged_content += os.linesep
+ output_file.write_text(merged_content)
+
+
+if __name__ == "__main__":
+ merge(DOTENV_FILE, PRODUCTION_DOTENV_FILES)
diff --git a/production.yml b/production.yml
new file mode 100644
index 0000000..4aadfb5
--- /dev/null
+++ b/production.yml
@@ -0,0 +1,73 @@
+version: '3'
+
+volumes:
+ production_postgres_data: {}
+ production_postgres_data_backups: {}
+ production_traefik: {}
+
+services:
+ django: &django
+ build:
+ context: .
+ dockerfile: ./compose/production/django/Dockerfile
+
+ image: pyblackbird_cc_production_django
+ depends_on:
+ - postgres
+ - redis
+ env_file:
+ - ./.envs/.production/.django
+ - ./.envs/.production/.postgres
+ command: /start
+
+ postgres:
+ build:
+ context: .
+ dockerfile: ./compose/production/postgres/Dockerfile
+ image: pyblackbird_cc_production_postgres
+ volumes:
+ - production_postgres_data:/var/lib/postgresql/data
+ - production_postgres_data_backups:/backups
+ env_file:
+ - ./.envs/.production/.postgres
+
+ traefik:
+ build:
+ context: .
+ dockerfile: ./compose/production/traefik/Dockerfile
+ image: pyblackbird_cc_production_traefik
+ depends_on:
+ - django
+ volumes:
+ - production_traefik:/etc/traefik/acme
+ ports:
+ - '0.0.0.0:80:80'
+ - '0.0.0.0:443:443'
+ - '0.0.0.0:5555:5555'
+
+ redis:
+ image: docker.io/redis:6
+
+ celeryworker:
+ <<: *django
+ image: pyblackbird_cc_production_celeryworker
+ command: /start-celeryworker
+
+ celerybeat:
+ <<: *django
+ image: pyblackbird_cc_production_celerybeat
+ command: /start-celerybeat
+
+ flower:
+ <<: *django
+ image: pyblackbird_cc_production_flower
+ command: /start-flower
+
+ awscli:
+ build:
+ context: .
+ dockerfile: ./compose/production/aws/Dockerfile
+ env_file:
+ - ./.envs/.production/.django
+ volumes:
+ - production_postgres_data_backups:/backups:z
diff --git a/pyblackbird_cc/__init__.py b/pyblackbird_cc/__init__.py
new file mode 100644
index 0000000..3da9e5f
--- /dev/null
+++ b/pyblackbird_cc/__init__.py
@@ -0,0 +1,5 @@
+__version__ = "0.1.0"
+__version_info__ = tuple(
+ int(num) if num.isdigit() else num
+ for num in __version__.replace("-", ".", 1).split(".")
+)
diff --git a/pyblackbird_cc/conftest.py b/pyblackbird_cc/conftest.py
new file mode 100644
index 0000000..966a3e5
--- /dev/null
+++ b/pyblackbird_cc/conftest.py
@@ -0,0 +1,14 @@
+import pytest
+
+from pyblackbird_cc.users.models import User
+from pyblackbird_cc.users.tests.factories import UserFactory
+
+
+@pytest.fixture(autouse=True)
+def _media_storage(settings, tmpdir) -> None:
+ settings.MEDIA_ROOT = tmpdir.strpath
+
+
+@pytest.fixture()
+def user(db) -> User:
+ return UserFactory()
diff --git a/pyblackbird_cc/contrib/__init__.py b/pyblackbird_cc/contrib/__init__.py
new file mode 100644
index 0000000..1c7ecc8
--- /dev/null
+++ b/pyblackbird_cc/contrib/__init__.py
@@ -0,0 +1,5 @@
+"""
+To understand why this file is here, please read:
+
+http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
+"""
diff --git a/pyblackbird_cc/contrib/sites/__init__.py b/pyblackbird_cc/contrib/sites/__init__.py
new file mode 100644
index 0000000..1c7ecc8
--- /dev/null
+++ b/pyblackbird_cc/contrib/sites/__init__.py
@@ -0,0 +1,5 @@
+"""
+To understand why this file is here, please read:
+
+http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
+"""
diff --git a/pyblackbird_cc/contrib/sites/migrations/0001_initial.py b/pyblackbird_cc/contrib/sites/migrations/0001_initial.py
new file mode 100644
index 0000000..fd76afb
--- /dev/null
+++ b/pyblackbird_cc/contrib/sites/migrations/0001_initial.py
@@ -0,0 +1,43 @@
+import django.contrib.sites.models
+from django.contrib.sites.models import _simple_domain_name_validator
+from django.db import migrations
+from django.db import models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = []
+
+ operations = [
+ migrations.CreateModel(
+ name="Site",
+ fields=[
+ (
+ "id",
+ models.AutoField(
+ verbose_name="ID",
+ serialize=False,
+ auto_created=True,
+ primary_key=True,
+ ),
+ ),
+ (
+ "domain",
+ models.CharField(
+ max_length=100,
+ verbose_name="domain name",
+ validators=[_simple_domain_name_validator],
+ ),
+ ),
+ ("name", models.CharField(max_length=50, verbose_name="display name")),
+ ],
+ options={
+ "ordering": ("domain",),
+ "db_table": "django_site",
+ "verbose_name": "site",
+ "verbose_name_plural": "sites",
+ },
+ bases=(models.Model,),
+ managers=[("objects", django.contrib.sites.models.SiteManager())],
+ ),
+ ]
diff --git a/pyblackbird_cc/contrib/sites/migrations/0002_alter_domain_unique.py b/pyblackbird_cc/contrib/sites/migrations/0002_alter_domain_unique.py
new file mode 100644
index 0000000..4a44a6a
--- /dev/null
+++ b/pyblackbird_cc/contrib/sites/migrations/0002_alter_domain_unique.py
@@ -0,0 +1,21 @@
+import django.contrib.sites.models
+from django.db import migrations
+from django.db import models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [("sites", "0001_initial")]
+
+ operations = [
+ migrations.AlterField(
+ model_name="site",
+ name="domain",
+ field=models.CharField(
+ max_length=100,
+ unique=True,
+ validators=[django.contrib.sites.models._simple_domain_name_validator],
+ verbose_name="domain name",
+ ),
+ )
+ ]
diff --git a/pyblackbird_cc/contrib/sites/migrations/0003_set_site_domain_and_name.py b/pyblackbird_cc/contrib/sites/migrations/0003_set_site_domain_and_name.py
new file mode 100644
index 0000000..f4b1cbb
--- /dev/null
+++ b/pyblackbird_cc/contrib/sites/migrations/0003_set_site_domain_and_name.py
@@ -0,0 +1,63 @@
+"""
+To understand why this file is here, please read:
+
+http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
+"""
+from django.conf import settings
+from django.db import migrations
+
+
+def _update_or_create_site_with_sequence(site_model, connection, domain, name):
+ """Update or create the site with default ID and keep the DB sequence in sync."""
+ site, created = site_model.objects.update_or_create(
+ id=settings.SITE_ID,
+ defaults={
+ "domain": domain,
+ "name": name,
+ },
+ )
+ if created:
+ # We provided the ID explicitly when creating the Site entry, therefore the DB
+ # sequence to auto-generate them wasn't used and is now out of sync. If we
+ # don't do anything, we'll get a unique constraint violation the next time a
+ # site is created.
+ # To avoid this, we need to manually update DB sequence and make sure it's
+ # greater than the maximum value.
+ max_id = site_model.objects.order_by("-id").first().id
+ with connection.cursor() as cursor:
+ cursor.execute("SELECT last_value from django_site_id_seq")
+ (current_id,) = cursor.fetchone()
+ if current_id <= max_id:
+ cursor.execute(
+ "alter sequence django_site_id_seq restart with %s",
+ [max_id + 1],
+ )
+
+
+def update_site_forward(apps, schema_editor):
+ """Set site domain and name."""
+ Site = apps.get_model("sites", "Site")
+ _update_or_create_site_with_sequence(
+ Site,
+ schema_editor.connection,
+ "resources.joannalemon.com",
+ "pyblackbird-cc",
+ )
+
+
+def update_site_backward(apps, schema_editor):
+ """Revert site domain and name to default."""
+ Site = apps.get_model("sites", "Site")
+ _update_or_create_site_with_sequence(
+ Site,
+ schema_editor.connection,
+ "example.com",
+ "example.com",
+ )
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [("sites", "0002_alter_domain_unique")]
+
+ operations = [migrations.RunPython(update_site_forward, update_site_backward)]
diff --git a/pyblackbird_cc/contrib/sites/migrations/0004_alter_options_ordering_domain.py b/pyblackbird_cc/contrib/sites/migrations/0004_alter_options_ordering_domain.py
new file mode 100644
index 0000000..f7118ca
--- /dev/null
+++ b/pyblackbird_cc/contrib/sites/migrations/0004_alter_options_ordering_domain.py
@@ -0,0 +1,21 @@
+# Generated by Django 3.1.7 on 2021-02-04 14:49
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ("sites", "0003_set_site_domain_and_name"),
+ ]
+
+ operations = [
+ migrations.AlterModelOptions(
+ name="site",
+ options={
+ "ordering": ["domain"],
+ "verbose_name": "site",
+ "verbose_name_plural": "sites",
+ },
+ ),
+ ]
diff --git a/pyblackbird_cc/contrib/sites/migrations/__init__.py b/pyblackbird_cc/contrib/sites/migrations/__init__.py
new file mode 100644
index 0000000..1c7ecc8
--- /dev/null
+++ b/pyblackbird_cc/contrib/sites/migrations/__init__.py
@@ -0,0 +1,5 @@
+"""
+To understand why this file is here, please read:
+
+http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
+"""
diff --git a/pyblackbird_cc/resources/__init__.py b/pyblackbird_cc/resources/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/pyblackbird_cc/resources/__init__.py
diff --git a/pyblackbird_cc/resources/admin.py b/pyblackbird_cc/resources/admin.py
new file mode 100644
index 0000000..846f6b4
--- /dev/null
+++ b/pyblackbird_cc/resources/admin.py
@@ -0,0 +1 @@
+# Register your models here.
diff --git a/pyblackbird_cc/resources/apps.py b/pyblackbird_cc/resources/apps.py
new file mode 100644
index 0000000..2756fc0
--- /dev/null
+++ b/pyblackbird_cc/resources/apps.py
@@ -0,0 +1,6 @@
+from django.apps import AppConfig
+
+
+class ResourcesConfig(AppConfig):
+ default_auto_field = "django.db.models.BigAutoField"
+ name = "pyblackbird_cc.resources"
diff --git a/pyblackbird_cc/resources/migrations/__init__.py b/pyblackbird_cc/resources/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/pyblackbird_cc/resources/migrations/__init__.py
diff --git a/pyblackbird_cc/resources/models.py b/pyblackbird_cc/resources/models.py
new file mode 100644
index 0000000..6b20219
--- /dev/null
+++ b/pyblackbird_cc/resources/models.py
@@ -0,0 +1 @@
+# Create your models here.
diff --git a/pyblackbird_cc/resources/tests.py b/pyblackbird_cc/resources/tests.py
new file mode 100644
index 0000000..a39b155
--- /dev/null
+++ b/pyblackbird_cc/resources/tests.py
@@ -0,0 +1 @@
+# Create your tests here.
diff --git a/pyblackbird_cc/resources/views.py b/pyblackbird_cc/resources/views.py
new file mode 100644
index 0000000..60f00ef
--- /dev/null
+++ b/pyblackbird_cc/resources/views.py
@@ -0,0 +1 @@
+# Create your views here.
diff --git a/pyblackbird_cc/static/css/project.css b/pyblackbird_cc/static/css/project.css
new file mode 100644
index 0000000..f1d543d
--- /dev/null
+++ b/pyblackbird_cc/static/css/project.css
@@ -0,0 +1,13 @@
+/* These styles are generated from project.scss. */
+
+.alert-debug {
+ color: black;
+ background-color: white;
+ border-color: #d6e9c6;
+}
+
+.alert-error {
+ color: #b94a48;
+ background-color: #f2dede;
+ border-color: #eed3d7;
+}
diff --git a/pyblackbird_cc/static/css/wrapper.css b/pyblackbird_cc/static/css/wrapper.css
new file mode 100644
index 0000000..c98d927
--- /dev/null
+++ b/pyblackbird_cc/static/css/wrapper.css
@@ -0,0 +1,492 @@
+*::before,
+*::after {
+ box-sizing: border-box;
+}
+
+* {
+ font-family: 'Franklin';
+ margin: 0;
+ padding: 0;
+}
+
+@font-face {
+ font-family: 'Franklin';
+ src: url(../fonts/LibreFranklin-VariableFont_wght.ttf);
+}
+
+@font-face {
+ font-family: 'Franklin-Italic';
+ src: url(../fonts/LibreFranklin-Italic.ttf);
+}
+
+body {
+ background: rgb(224, 221, 217, 0.27);
+}
+
+h1 {
+ color: #657c76;
+ font-size: 2.0rem;
+}
+
+h2 {
+ color: #4e8273;
+ /* color: white; */
+ font-size: 1.8rem;
+ padding-bottom: 10px;
+ margin-right: 20px;
+ margin-top: 20px;
+ border-radius: 3px 3px 0 0;
+ padding-left: 2px;
+ background-size: 100% 50px;
+ background-repeat: no-repeat;
+ border-bottom: 10px solid #E4E5E7;
+ overflow: auto;
+}
+
+.container {
+ max-width: 87%;
+ margin: 0 auto;
+ display: grid;
+ gap: 0.2rem;
+}
+
+.cell {
+ background: white;
+ margin-bottom: 20px;
+ margin-left: 20px;
+ margin-right: 20px;
+ padding-bottom: 10px;
+ padding-left: 50px;
+ padding-top: 20px;
+ border: 0px solid lightgray;
+ border-radius: 5px;
+}
+
+.cell#create-form-intro p {
+ background: #bcd8d0;
+ color: black;
+ font-size: 0.9rem;
+ margin: 10px 20px 10px 0px;
+ max-width: max-content;
+}
+
+.cell p {
+ color: rgb(37, 95, 140, 0.8);
+ font-size: 1.2rem;
+ padding-left: 15px;
+}
+
+q {
+ display: inline;
+}
+
+q:before {
+ content: open-quote;
+}
+
+q:after {
+ content: close-quote;
+}
+
+img {
+ border-radius: 5px;
+ margin-right: 20px;
+ box-shadow: 3px 2px 2px lightgray;
+ max-width: 400px;
+ height: auto;
+ width: 100%;
+}
+
+.inner-grid_1 {
+ display: grid;
+ grid-template-columns: repeat(2, 1fr);
+ gap: 20px;
+ margin: 22px 10px 10px 0px;
+}
+
+.inner-grid_1 p {
+ font-size: 1.6rem;
+ color: darkgray;
+ padding-right: 100px;
+ padding-top: 20px;
+ padding-bottom: 100px;
+ text-align: right;
+}
+
+.inner-grid_1 p#sewing-blurb {
+ font-size: 1.5rem;
+ color: darkgray;
+ padding-right: 100px;
+ padding-top: 20px;
+ padding-bottom: 100px;
+ text-align: right;
+}
+
+.inner-grid_2 {
+ display: grid;
+ grid-template-columns: repeat(3, 1fr);
+ gap: 20px;
+ margin: 10px 10px 10px 0px;
+ padding-right: 18px;
+}
+
+.inner_grid_2-img {
+ box-shadow: 2px 2px 2px lightgray;
+ border-radius: 2px;
+}
+
+.divider {
+ color: #e0d9de;
+ border-width: 1;
+ margin: 10px 20px 20px 0px;
+}
+
+
+a {
+ font-size: inherit;
+ color: #394f49;
+ text-decoration: none;
+}
+
+/* a nice style for a large h2 link*/
+a.no-underline:hover {
+ font-size: 1.8rem;
+ color: #4e8273;
+ text-decoration: none;
+}
+
+header {
+ padding-left: 10px;
+ max-width: fit-content;
+ margin-left: auto;
+ margin-right: auto;
+ margin-top: 50px;
+}
+
+.inner-header {
+ display: grid;
+ grid-template-columns: 1fr 2fr 1fr;
+ gap: 10px;
+ margin-bottom: 20px;
+}
+
+.info {
+ margin-left: auto;
+ margin-right: auto;
+ color: darkgray;
+ text-align: center;
+}
+
+.info p {
+ font-size: 1.1rem;
+ padding: 10px;
+}
+
+
+.jumplist {
+ font-size: 1.1rem;
+ display: grid;
+ grid-template-columns: repeat(3, 1fr);
+ margin-top: 20px;
+}
+
+.jumplist a {
+ font-weight: bold;
+ color: #657c76;
+}
+
+a:hover {
+ color: #2c3d38;
+ text-decoration: underline;
+}
+
+
+.reviews_quote {
+ font-size: 1.3rem;
+ font-family: "Franklin-Italic";
+ line-height: 1.2em;
+ color: #4e8273;
+ margin-left: 2rem;
+ padding-right: 30px;
+ padding-top: 20px;
+ padding-bottom: 100px
+}
+
+.hs_image {
+ margin-left: auto;
+ margin-right: 20px;
+ margin-top: 20px;
+ max-width: 95%;
+}
+
+/* this means a p subling to reviews_quote */
+.reviews_quote ~ p {
+ color: darkgray;
+ padding: 10px 0px;
+ margin-bottom: 20px;
+}
+
+.reviews_quote_container {
+ padding: 0px 100px 0px 100px;
+ border-bottom: 5px solid #f4f4f4;
+ margin: 30px 25px 20px 25px;
+}
+
+.footer {
+ margin-left: auto;
+ margin-right: auto;
+ margin-bottom: 10px;
+ color: darkgray;
+ font-size: 0.8rem;
+ text-align: center;
+}
+
+.footer > p {
+ padding: 5px;
+}
+
+/* Media query for narrow screens */
+@media only screen and (max-width: 600px) {
+ .inner-grid_1 {
+ grid-template-columns: 1fr; /* Switch to single column layout */
+ }
+
+ .inner-grid_1 p {
+ text-align: left;
+ font-size: 1.5rem;
+ padding-top: 1px;
+ margin-bottom: 5px;
+ }
+
+ .inner-grid_1 p#sewing-blurb {
+ font-size: 1.5rem;
+ color: darkgray;
+ padding-right: 10px;
+ }
+
+ .inner-grid_2 {
+ grid-template-columns: 1fr; /* Switch to single column layout */
+ }
+
+ .container {
+ max-width: 97%;
+ }
+
+ .cell {
+ padding-left: 20px;
+ }
+
+ img {
+ padding: 0;
+ }
+
+ .reviews_quote_container {
+ padding-left: 10px;
+ padding-right: 10px;
+ }
+}
+
+@media only screen and (max-width: 1200px) {
+ .inner-grid_1 p {
+ text-align: left;
+ font-size: 1.7rem;
+ padding-top: 10px;
+ padding-right: 20px;
+ }
+
+ .inner-grid_1 p#sewing-blurb {
+ font-size: 1.4rem;
+ padding-top: 5px;
+ padding-right: 20px;
+ }
+}
+
+@media only screen and (max-width: 900px) {
+ .inner-grid_1 p {
+ text-align: left;
+ font-size: 1.2rem;
+ padding-top: 10px;
+ padding-right: 20px;
+ }
+
+ .inner-grid_1 p#sewing-blurb {
+ font-size: 1.2rem;
+ padding-top: 5px;
+ }
+
+ .reviews_quote_container {
+ padding-left: 10px;
+ padding-right: 10px;
+ }
+}
+
+:root {
+ box-sizing: border-box;
+ --co-body-bg: #eee;
+ --co-body-text: #444;
+ --co-body-accent: #4834d4;
+ --co-body-accent-contrast: #fff;
+ --co-textfld-bg: #fff;
+ --co-textfld-border: #ccc;
+ --co-textfld-active-border: #aaa;
+ --co-textfld-focus-border: var(--co-body-accent);
+ --co-textfld-valid-border: hsl(140 50% 75%);
+ --co-textfld-valid-active-border: hsl(140 50% 65%);
+ --co-textfld-valid-focus-border: hsl(140 50% 50%);
+ --co-textfld-invalid-border: hsl(20 65% 75%);
+ --co-textfld-invalid-active-border: hsl(20 65% 65%);
+ --co-textfld-invalid-focus-border: hsl(20 65% 50%);
+ --co-btn-text: var(--co-body-accent-contrast);
+ --co-btn-bg: var(--co-body-accent);
+ --co-btn-active-bg: #333;
+ --co-btn-focus-bg: #333;
+}
+
+.dark-mode {
+ --co-body-bg: #111;
+ --co-body-text: #ddd;
+ --co-body-accent: #6c5ce7;
+ --co-body-accent-contrast: #fff;
+
+ --co-textfld-bg: #222;
+ --co-textfld-border: #333;
+ --co-textfld-active-border: #444;
+ --co-textfld-focus-border: var(--co-body-accent);
+
+ --co-textfld-valid-border: hsl(140 90% 20%);
+ --co-textfld-valid-active-border: hsl(140 90% 30%);
+ --co-textfld-valid-focus-border: hsl(140 90% 45%);
+
+ --co-textfld-invalid-border: hsl(20 90% 20%);
+ --co-textfld-invalid-active-border: hsl(20 90% 30%);
+ --co-textfld-invalid-focus-border: hsl(20 90% 45%);
+
+ --co-btn-text: var(--co-body-accent-contrast);
+ --co-btn-bg: var(--co-body-accent);
+ --co-btn-active-bg: #333;
+ --co-btn-focus-bg: #333;
+}
+
+.dark-mode {
+ color-scheme: dark;
+}
+
+*,
+*::before,
+*::after {
+ box-sizing: inherit;
+}
+
+body {
+ font: 1em/160% sans-serif;
+ background-color: var(--co-body-bg);
+ color: var(--co-body-text);
+}
+
+
+.resource-metadata-panel {
+ max-width: 95%;
+ border-radius: 6px;
+ background-color: lightgray; /* Choose a nice green color */
+ padding: 20px;
+ box-sizing: border-box;
+ color: #393939;
+ margin-top: 20px;
+ margin-right: 20px;
+}
+
+.resource-title {
+ color: #242424;
+ margin: 10px 0px 20px 0px;
+ font-size: 1.5rem;
+}
+
+.resource-details {
+ display: flex;
+ justify-content: space-between;
+}
+
+.resource-details div {
+ font-size: 1.1rem;
+ font-weight: bold;
+}
+
+.resource-img-detail {
+ margin-top: 24px;
+ display: flex;
+ flex-wrap: wrap;
+ justify-content: center;
+ gap: 10px;
+}
+
+.resource-img-detail img {
+ max-height: 400px;
+ width: auto;
+ object-fit: contain;
+ flex: 0 0 calc(33.33% - 10px);
+}
+
+@media screen and (max-width: 768px) {
+ .resource-img-detail img {
+ flex: 0 0 calc(50% - 10px);
+ }
+}
+
+@media screen and (max-width: 480px) {
+ .resource-img-detail img {
+ flex: 0 0 100%;
+ }
+}
+
+.resource-download-panel {
+ max-width: 95%;
+ margin-bottom: 16px;
+ margin-top: 16px;
+ padding: 16px 24px 24px;
+ background-color: #fff;
+ border-radius: 4px;
+ box-shadow: 0 1px 5px 0 rgba(0, 0, 0, .2), 0 2px 1px 0 rgba(0, 0, 0, .12), 0 1px 1px 0 rgba(0, 0, 0, .12);
+}
+
+.resource-download-panel h4 {
+ color: green;
+ font-size: 1.2rem;
+}
+
+.resource-description-panel {
+ max-width: 95%;
+ margin-bottom: 16px;
+ margin-top: 16px;
+ padding: 16px 24px 24px;
+ background-color: #fff;
+ border-radius: 4px;
+ box-shadow: 0 1px 5px 0 rgba(0, 0, 0, .2), 0 2px 1px 0 rgba(0, 0, 0, .12), 0 1px 1px 0 rgba(0, 0, 0, .12);
+}
+
+.resource-description-panel h3 {
+ margin-top: 12px;
+}
+
+/* to select any h3 tag after a div of class resource-metadata-panel */
+.feature-pdf-page-title {
+ background: #598268;
+ margin: 20px 0px 10px 0px;
+ max-width: 95%;
+ padding: 10px 12px 10px;
+ color: white;
+ border-radius: 4px;
+}
+
+.admin-links {
+ display: flex;
+ justify-content: space-between;
+ margin-right: 40px;
+}
+
+.admin-links a {
+ padding: 10px 20px;
+ background-color: #f4b938;
+ color: black;
+ border-radius: 4px;
+ text-decoration: none;
+}
diff --git a/pyblackbird_cc/static/fonts/.gitkeep b/pyblackbird_cc/static/fonts/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/pyblackbird_cc/static/fonts/.gitkeep
diff --git a/pyblackbird_cc/static/fonts/LibreFranklin-Italic.ttf b/pyblackbird_cc/static/fonts/LibreFranklin-Italic.ttf
new file mode 100644
index 0000000..e0b3c80
--- /dev/null
+++ b/pyblackbird_cc/static/fonts/LibreFranklin-Italic.ttf
Binary files differ
diff --git a/pyblackbird_cc/static/fonts/LibreFranklin-VariableFont_wght.ttf b/pyblackbird_cc/static/fonts/LibreFranklin-VariableFont_wght.ttf
new file mode 100644
index 0000000..4c4c09c
--- /dev/null
+++ b/pyblackbird_cc/static/fonts/LibreFranklin-VariableFont_wght.ttf
Binary files differ
diff --git a/pyblackbird_cc/static/images/favicons/favicon.ico b/pyblackbird_cc/static/images/favicons/favicon.ico
new file mode 100644
index 0000000..e1c1dd1
--- /dev/null
+++ b/pyblackbird_cc/static/images/favicons/favicon.ico
Binary files differ
diff --git a/pyblackbird_cc/static/js/project.js b/pyblackbird_cc/static/js/project.js
new file mode 100644
index 0000000..d26d23b
--- /dev/null
+++ b/pyblackbird_cc/static/js/project.js
@@ -0,0 +1 @@
+/* Project specific Javascript goes here. */
diff --git a/pyblackbird_cc/templates/403.html b/pyblackbird_cc/templates/403.html
new file mode 100644
index 0000000..40954bb
--- /dev/null
+++ b/pyblackbird_cc/templates/403.html
@@ -0,0 +1,15 @@
+{% extends "base.html" %}
+
+{% block title %}
+ Forbidden (403)
+{% endblock title %}
+{% block content %}
+ <h1>Forbidden (403)</h1>
+ <p>
+ {% if exception %}
+ {{ exception }}
+ {% else %}
+ You're not allowed to access this page.
+ {% endif %}
+ </p>
+{% endblock content %}
diff --git a/pyblackbird_cc/templates/403_csrf.html b/pyblackbird_cc/templates/403_csrf.html
new file mode 100644
index 0000000..40954bb
--- /dev/null
+++ b/pyblackbird_cc/templates/403_csrf.html
@@ -0,0 +1,15 @@
+{% extends "base.html" %}
+
+{% block title %}
+ Forbidden (403)
+{% endblock title %}
+{% block content %}
+ <h1>Forbidden (403)</h1>
+ <p>
+ {% if exception %}
+ {{ exception }}
+ {% else %}
+ You're not allowed to access this page.
+ {% endif %}
+ </p>
+{% endblock content %}
diff --git a/pyblackbird_cc/templates/404.html b/pyblackbird_cc/templates/404.html
new file mode 100644
index 0000000..2399b79
--- /dev/null
+++ b/pyblackbird_cc/templates/404.html
@@ -0,0 +1,15 @@
+{% extends "base.html" %}
+
+{% block title %}
+ Page not found
+{% endblock title %}
+{% block content %}
+ <h1>Page not found</h1>
+ <p>
+ {% if exception %}
+ {{ exception }}
+ {% else %}
+ This is not the page you were looking for.
+ {% endif %}
+ </p>
+{% endblock content %}
diff --git a/pyblackbird_cc/templates/500.html b/pyblackbird_cc/templates/500.html
new file mode 100644
index 0000000..c4e2fa3
--- /dev/null
+++ b/pyblackbird_cc/templates/500.html
@@ -0,0 +1,12 @@
+{% extends "base.html" %}
+
+{% block title %}
+ Server Error
+{% endblock title %}
+{% block content %}
+ <h1>Ooops!!! 500</h1>
+ <h3>Looks like something went wrong!</h3>
+ <p>
+ We track these errors automatically, but if the problem persists feel free to contact us. In the meantime, try refreshing.
+ </p>
+{% endblock content %}
diff --git a/pyblackbird_cc/templates/account/base_manage_password.html b/pyblackbird_cc/templates/account/base_manage_password.html
new file mode 100644
index 0000000..20c44f7
--- /dev/null
+++ b/pyblackbird_cc/templates/account/base_manage_password.html
@@ -0,0 +1,10 @@
+{% extends "account/base_manage.html" %}
+
+{% block main %}
+ <div class="card">
+ <div class="card-body">
+ {% block content %}
+ {% endblock content %}
+ </div>
+ </div>
+{% endblock main %}
diff --git a/pyblackbird_cc/templates/allauth/elements/alert.html b/pyblackbird_cc/templates/allauth/elements/alert.html
new file mode 100644
index 0000000..535d394
--- /dev/null
+++ b/pyblackbird_cc/templates/allauth/elements/alert.html
@@ -0,0 +1,7 @@
+{% load i18n %}
+{% load allauth %}
+
+<div class="alert alert-error">
+ {% slot message %}
+{% endslot %}
+</div>
diff --git a/pyblackbird_cc/templates/allauth/elements/badge.html b/pyblackbird_cc/templates/allauth/elements/badge.html
new file mode 100644
index 0000000..e86669b
--- /dev/null
+++ b/pyblackbird_cc/templates/allauth/elements/badge.html
@@ -0,0 +1,6 @@
+{% load allauth %}
+
+<span class="badge {% if 'success' in attrs.tags %}bg-success{% endif %} {% if 'warning' in attrs.tags %}bg-warning{% endif %} {% if 'secondary' in attrs.tags %}bg-secondary{% endif %} {% if 'danger' in attrs.tags %}bg-danger{% endif %} {% if 'primary' in attrs.tags %}bg-primary{% endif %}">
+ {% slot %}
+{% endslot %}
+</span>
diff --git a/pyblackbird_cc/templates/allauth/elements/button.html b/pyblackbird_cc/templates/allauth/elements/button.html
new file mode 100644
index 0000000..b88a209
--- /dev/null
+++ b/pyblackbird_cc/templates/allauth/elements/button.html
@@ -0,0 +1,20 @@
+{% load allauth %}
+
+{% comment %} djlint:off {% endcomment %}
+<{% if attrs.href %}a href="{{ attrs.href }}"{% else %}button{% endif %}
+ {% if attrs.form %}form="{{ attrs.form }}"{% endif %}
+ {% if attrs.id %}id="{{ attrs.id }}"{% endif %}
+ {% if attrs.name %}name="{{ attrs.name }}"{% endif %}
+ {% if attrs.type %}type="{{ attrs.type }}"{% endif %}
+ class="btn
+{% if 'success' in attrs.tags %}btn-success
+{% elif 'warning' in attrs.tags %}btn-warning
+{% elif 'secondary' in attrs.tags %}btn-secondary
+{% elif 'danger' in attrs.tags %}btn-danger
+{% elif 'primary' in attrs.tags %}btn-primary
+{% else %}btn-primary
+{% endif %}"
+>
+ {% slot %}
+ {% endslot %}
+ </{% if attrs.href %}a{% else %}button{% endif %}>
diff --git a/pyblackbird_cc/templates/allauth/elements/field.html b/pyblackbird_cc/templates/allauth/elements/field.html
new file mode 100644
index 0000000..dc5f303
--- /dev/null
+++ b/pyblackbird_cc/templates/allauth/elements/field.html
@@ -0,0 +1,66 @@
+{% load allauth %}
+{% load crispy_forms_tags %}
+
+{% if attrs.type == "textarea" %}
+ <div class="row mb-3">
+ <div class="col-sm-10">
+ <label for="{{ attrs.id }}">
+ {% slot label %}
+ {% endslot %}
+ </label>
+ </div>
+ <textarea {% if attrs.required %}required{% endif %}
+ {% if attrs.rows %}rows="{{ attrs.rows }}"{% endif %}
+ {% if attrs.disabled %}disabled{% endif %}
+ {% if attrs.readonly %}readonly{% endif %}
+ {% if attrs.checked %}checked{% endif %}
+ {% if attrs.name %}name="{{ attrs.name }}"{% endif %}
+ {% if attrs.id %}id="{{ attrs.id }}"{% endif %}
+ {% if attrs.placeholder %}placeholder="{{ attrs.placeholder }}"{% endif %}
+ class="form-control">{% slot value %}{% endslot %}</textarea>
+</div>
+{% elif attrs.type == "radio" %}
+<div class="row mb-3">
+ <div class="col-sm-10">
+ <div class="form-check">
+ <input {% if attrs.required %}required{% endif %}
+ {% if attrs.disabled %}disabled{% endif %}
+ {% if attrs.readonly %}readonly{% endif %}
+ {% if attrs.checked %}checked{% endif %}
+ {% if attrs.name %}name="{{ attrs.name }}"{% endif %}
+ {% if attrs.id %}id="{{ attrs.id }}"{% endif %}
+ {% if attrs.placeholder %}placeholder="{{ attrs.placeholder }}"{% endif %}
+ {% if attrs.autocomplete %}autocomplete="{{ attrs.autocomplete }}"{% endif %}
+ value="{{ attrs.value|default_if_none:"" }}"
+ type="{{ attrs.type }}" />
+ <label class="form-check-label" for="{{ attrs.id }}">
+ {% slot label %}
+ {% endslot %}
+ </label>
+ </div>
+</div>
+</div>
+{% else %}
+<div class="col-sm-10">
+ <label for="{{ attrs.id }}">
+ {% slot label %}
+ {% endslot %}
+</label>
+</div>
+<div class="col-sm-10">
+ <input {% if attrs.required %}required{% endif %}
+ {% if attrs.disabled %}disabled{% endif %}
+ {% if attrs.readonly %}readonly{% endif %}
+ {% if attrs.checked %}checked{% endif %}
+ {% if attrs.name %}name="{{ attrs.name }}"{% endif %}
+ {% if attrs.id %}id="{{ attrs.id }}"{% endif %}
+ {% if attrs.placeholder %}placeholder="{{ attrs.placeholder }}"{% endif %}
+ {% if attrs.autocomplete %}autocomplete="{{ attrs.autocomplete }}"{% endif %}
+ value="{{ attrs.value|default_if_none:"" }}"
+ type="{{ attrs.type }}"
+ class="form-control" />
+</div>
+{% endif %}
+{% if slots.help_text %}
+ <div class="form-text">{% slot help_text %}{% endslot %}</div>
+{% endif %}
diff --git a/pyblackbird_cc/templates/allauth/elements/fields.html b/pyblackbird_cc/templates/allauth/elements/fields.html
new file mode 100644
index 0000000..ae8e104
--- /dev/null
+++ b/pyblackbird_cc/templates/allauth/elements/fields.html
@@ -0,0 +1,3 @@
+{% load crispy_forms_tags %}
+
+{{ attrs.form|crispy }}
diff --git a/pyblackbird_cc/templates/allauth/elements/panel.html b/pyblackbird_cc/templates/allauth/elements/panel.html
new file mode 100644
index 0000000..43a7a54
--- /dev/null
+++ b/pyblackbird_cc/templates/allauth/elements/panel.html
@@ -0,0 +1,19 @@
+{% load allauth %}
+
+<section>
+ <div class="card mb-4">
+ <div class="card-body">
+ <h2 class="card-title">
+ {% slot title %}
+ {% endslot %}
+ </h2>
+ {% slot body %}
+ {% endslot %}
+ {% if slots.actions %}
+ <ul>
+ {% for action in slots.actions %}<li>{{ action }}</li>{% endfor %}
+ </ul>
+ {% endif %}
+</div>
+</div>
+</section>
diff --git a/pyblackbird_cc/templates/allauth/elements/table.html b/pyblackbird_cc/templates/allauth/elements/table.html
new file mode 100644
index 0000000..13cc5da
--- /dev/null
+++ b/pyblackbird_cc/templates/allauth/elements/table.html
@@ -0,0 +1,6 @@
+{% load allauth %}
+
+<table class="table">
+ {% slot %}
+{% endslot %}
+</table>
diff --git a/pyblackbird_cc/templates/allauth/layouts/entrance.html b/pyblackbird_cc/templates/allauth/layouts/entrance.html
new file mode 100644
index 0000000..4d585cf
--- /dev/null
+++ b/pyblackbird_cc/templates/allauth/layouts/entrance.html
@@ -0,0 +1,34 @@
+{% extends "base.html" %}
+
+{% load i18n %}
+
+{% block bodyclass %}
+ bg-light
+{% endblock bodyclass %}
+{% block css %}
+ {{ block.super }}
+{% endblock css %}
+{% block title %}
+ {% block head_title %}
+ {% trans "Sign In" %}
+ {% endblock head_title %}
+{% endblock title %}
+{% block body %}
+ <div class="d-flex justify-content-center h-100 py-4">
+ <div class="col-md-4 py-4 my-4 px-4">
+ {% if messages %}
+ {% for message in messages %}
+ <div class="alert alert-dismissible {% if message.tags %}alert-{{ message.tags }}{% endif %}">
+ {{ message }}
+ <button type="button"
+ class="btn-close"
+ data-bs-dismiss="alert"
+ aria-label="Close"></button>
+ </div>
+ {% endfor %}
+ {% endif %}
+ {% block content %}
+ {% endblock content %}
+ </div>
+ </div>
+{% endblock body %}
diff --git a/pyblackbird_cc/templates/allauth/layouts/manage.html b/pyblackbird_cc/templates/allauth/layouts/manage.html
new file mode 100644
index 0000000..75b4959
--- /dev/null
+++ b/pyblackbird_cc/templates/allauth/layouts/manage.html
@@ -0,0 +1,6 @@
+{% extends "base.html" %}
+
+{% block main %}
+ {% block content %}
+ {% endblock content %}
+{% endblock main %}
diff --git a/pyblackbird_cc/templates/base.html b/pyblackbird_cc/templates/base.html
new file mode 100644
index 0000000..7c6f1b6
--- /dev/null
+++ b/pyblackbird_cc/templates/base.html
@@ -0,0 +1,127 @@
+{% load static i18n %}
+
+<!DOCTYPE html>
+{% get_current_language as LANGUAGE_CODE %}
+<html lang="{{ LANGUAGE_CODE }}">
+ <head>
+ <meta charset="utf-8" />
+ <meta http-equiv="x-ua-compatible" content="ie=edge" />
+ <title>
+ {% block title %}
+ pyblackbird-cc
+ {% endblock title %}
+ </title>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <meta name="description" content="Joanna Lemon Resources" />
+ <meta name="author" content="Matthew Lemon" />
+ <link rel="icon" href="{% static 'images/favicons/favicon.ico' %}" />
+ {% block css %}
+ <!-- Latest compiled and minified Bootstrap CSS -->
+ <link rel="stylesheet"
+ href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.3/css/bootstrap.min.css"
+ integrity="sha512-SbiR/eusphKoMVVXysTKG/7VseWii+Y3FdHrt0EpKgpToZeemhqHeZeLWLhJutz/2ut2Vw1uQEj2MbRF+TVBUA=="
+ crossorigin="anonymous"
+ referrerpolicy="no-referrer" />
+ <!-- Your stuff: Third-party CSS libraries go here -->
+ <!-- This file stores project-specific CSS -->
+ <link href="{% static 'css/project.css' %}" rel="stylesheet" />
+ <link rel="stylesheet" href="{% static "css/wrapper.css" %}" type="text/css" media="screen" charset="utf-8" />
+ {% endblock css %}
+ <!-- Le javascript
+ ================================================== -->
+ {# Placed at the top of the document so pages load faster with defer #}
+ {% block javascript %}
+ <!-- Bootstrap JS -->
+ {#<script defer#}
+ {# src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.3/js/bootstrap.min.js"#}
+ {# integrity="sha512-1/RvZTcCDEUjY/CypiMz+iqqtaoQfAITmNSJY17Myp4Ms5mdxPS5UV7iOfdZoxcGhzFbOm6sntTKJppjvuhg4g=="#}
+ {# crossorigin="anonymous"#}
+ {# referrerpolicy="no-referrer"></script>#}
+ <!-- Your stuff: Third-party javascript libraries go here -->
+ <!-- place project specific Javascript in this file -->
+ <script defer src="{% static 'js/project.js' %}"></script>
+ {% endblock javascript %}
+ </head>
+ <body class="{% block bodyclass %}{% endblock bodyclass %}">
+ {% block body %}
+ <div class="mb-1">
+ <nav class="navbar navbar-expand-md navbar-light bg-light">
+ <div class="container-fluid">
+ <button class="navbar-toggler navbar-toggler-right"
+ type="button"
+ data-bs-toggle="collapse"
+ data-bs-target="#navbarSupportedContent"
+ aria-controls="navbarSupportedContent"
+ aria-expanded="false"
+ aria-label="Toggle navigation">
+ <span class="navbar-toggler-icon"></span>
+ </button>
+ <a class="navbar-brand" href="{% url 'home' %}">pyblackbird-cc</a>
+ <div class="collapse navbar-collapse" id="navbarSupportedContent">
+ <ul class="navbar-nav mr-auto">
+ <li class="nav-item active">
+ <a class="nav-link" href="{% url 'home' %}">Home <span class="visually-hidden">(current)</span></a>
+ </li>
+ <li class="nav-item">
+ <a class="nav-link" href="{% url 'about' %}">About</a>
+ </li>
+ {% if request.user.is_authenticated %}
+ <li class="nav-item">
+ <a class="nav-link" href="{% url 'users:detail' request.user.pk %}">{% translate "My Profile" %}</a>
+ </li>
+ <li class="nav-item">
+ {# URL provided by django-allauth/account/urls.py #}
+ <a class="nav-link" href="{% url 'account_logout' %}">{% translate "Sign Out" %}</a>
+ </li>
+ {% else %}
+ {% if ACCOUNT_ALLOW_REGISTRATION %}
+ <li class="nav-item">
+ {# URL provided by django-allauth/account/urls.py #}
+ <a id="sign-up-link" class="nav-link" href="{% url 'account_signup' %}">{% translate "Sign Up" %}</a>
+ </li>
+ {% endif %}
+ <li class="nav-item">
+ {# URL provided by django-allauth/account/urls.py #}
+ <a id="log-in-link" class="nav-link" href="{% url 'account_login' %}">{% translate "Sign In" %}</a>
+ </li>
+ {% endif %}
+ </ul>
+ </div>
+ </div>
+ </nav>
+ </div>
+ <div class="container">
+ {% if messages %}
+ {% for message in messages %}
+ <div class="alert alert-dismissible {% if message.tags %}alert-{{ message.tags }}{% endif %}">
+ {{ message }}
+ <button type="button"
+ class="btn-close"
+ data-bs-dismiss="alert"
+ aria-label="Close"></button>
+ </div>
+ {% endfor %}
+ {% endif %}
+ {% block main %}
+ {% block content %}
+ <p>Use this document as a way to quick start any new project.</p>
+ {% endblock content %}
+ {% endblock main %}
+ </div>
+ {% endblock body %}
+ <!-- /container -->
+ {% block modal %}
+ {% endblock modal %}
+ {% block inline_javascript %}
+ {% comment %}
+ Script tags with only code, no src (defer by default). To run
+ with a "defer" so that you run inline code:
+ <script>
+ window.addEventListener('DOMContentLoaded', () => {
+ /* Run whatever you want */
+ });
+ </script>
+ {% endcomment %}
+ {% endblock inline_javascript %}
+ </body>
+</html>
diff --git a/pyblackbird_cc/templates/pages/about.html b/pyblackbird_cc/templates/pages/about.html
new file mode 100644
index 0000000..94d9808
--- /dev/null
+++ b/pyblackbird_cc/templates/pages/about.html
@@ -0,0 +1 @@
+{% extends "base.html" %}
diff --git a/pyblackbird_cc/templates/pages/home.html b/pyblackbird_cc/templates/pages/home.html
new file mode 100644
index 0000000..94d9808
--- /dev/null
+++ b/pyblackbird_cc/templates/pages/home.html
@@ -0,0 +1 @@
+{% extends "base.html" %}
diff --git a/pyblackbird_cc/templates/users/user_detail.html b/pyblackbird_cc/templates/users/user_detail.html
new file mode 100644
index 0000000..7d52259
--- /dev/null
+++ b/pyblackbird_cc/templates/users/user_detail.html
@@ -0,0 +1,31 @@
+{% extends "base.html" %}
+
+{% load static %}
+
+{% block title %}
+ User:
+ {{ object.name }}
+{% endblock title %}
+{% block content %}
+ <div class="container">
+ <div class="row">
+ <div class="col-sm-12">
+ <h2>{{ object.name }}</h2>
+ </div>
+ </div>
+ {% if object == request.user %}
+ <!-- Action buttons -->
+ <div class="row">
+ <div class="col-sm-12">
+ <a class="btn btn-primary" href="{% url 'users:update' %}" role="button">My Info</a>
+ <a class="btn btn-primary"
+ href="{% url 'account_email' %}"
+ role="button">E-Mail</a>
+ <a class="btn btn-primary" href="{% url 'mfa_index' %}" role="button">MFA</a>
+ <!-- Your Stuff: Custom user template urls -->
+ </div>
+ </div>
+ <!-- End Action buttons -->
+ {% endif %}
+ </div>
+{% endblock content %}
diff --git a/pyblackbird_cc/templates/users/user_form.html b/pyblackbird_cc/templates/users/user_form.html
new file mode 100644
index 0000000..a53b304
--- /dev/null
+++ b/pyblackbird_cc/templates/users/user_form.html
@@ -0,0 +1,21 @@
+{% extends "base.html" %}
+
+{% load crispy_forms_tags %}
+
+{% block title %}
+ {{ user.name }}
+{% endblock title %}
+{% block content %}
+ <h1>{{ user.name }}</h1>
+ <form class="form-horizontal"
+ method="post"
+ action="{% url 'users:update' %}">
+ {% csrf_token %}
+ {{ form|crispy }}
+ <div class="control-group">
+ <div class="controls">
+ <button type="submit" class="btn btn-primary">Update</button>
+ </div>
+ </div>
+ </form>
+{% endblock content %}
diff --git a/pyblackbird_cc/users/__init__.py b/pyblackbird_cc/users/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/pyblackbird_cc/users/__init__.py
diff --git a/pyblackbird_cc/users/adapters.py b/pyblackbird_cc/users/adapters.py
new file mode 100644
index 0000000..b13f3ca
--- /dev/null
+++ b/pyblackbird_cc/users/adapters.py
@@ -0,0 +1,48 @@
+from __future__ import annotations
+
+import typing
+
+from allauth.account.adapter import DefaultAccountAdapter
+from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
+from django.conf import settings
+
+if typing.TYPE_CHECKING:
+ from allauth.socialaccount.models import SocialLogin
+ from django.http import HttpRequest
+
+ from pyblackbird_cc.users.models import User
+
+
+class AccountAdapter(DefaultAccountAdapter):
+ def is_open_for_signup(self, request: HttpRequest) -> bool:
+ return getattr(settings, "ACCOUNT_ALLOW_REGISTRATION", True)
+
+
+class SocialAccountAdapter(DefaultSocialAccountAdapter):
+ def is_open_for_signup(
+ self,
+ request: HttpRequest,
+ sociallogin: SocialLogin,
+ ) -> bool:
+ return getattr(settings, "ACCOUNT_ALLOW_REGISTRATION", True)
+
+ def populate_user(
+ self,
+ request: HttpRequest,
+ sociallogin: SocialLogin,
+ data: dict[str, typing.Any],
+ ) -> User:
+ """
+ Populates user information from social provider info.
+
+ See: https://docs.allauth.org/en/latest/socialaccount/advanced.html#creating-and-populating-user-instances
+ """
+ user = super().populate_user(request, sociallogin, data)
+ if not user.name:
+ if name := data.get("name"):
+ user.name = name
+ elif first_name := data.get("first_name"):
+ user.name = first_name
+ if last_name := data.get("last_name"):
+ user.name += f" {last_name}"
+ return user
diff --git a/pyblackbird_cc/users/admin.py b/pyblackbird_cc/users/admin.py
new file mode 100644
index 0000000..04da035
--- /dev/null
+++ b/pyblackbird_cc/users/admin.py
@@ -0,0 +1,49 @@
+from django.conf import settings
+from django.contrib import admin
+from django.contrib.auth import admin as auth_admin
+from django.contrib.auth.decorators import login_required
+from django.utils.translation import gettext_lazy as _
+
+from .forms import UserAdminChangeForm
+from .forms import UserAdminCreationForm
+from .models import User
+
+if settings.DJANGO_ADMIN_FORCE_ALLAUTH:
+ # Force the `admin` sign in process to go through the `django-allauth` workflow:
+ # https://docs.allauth.org/en/latest/common/admin.html#admin
+ admin.site.login = login_required(admin.site.login) # type: ignore[method-assign]
+
+
+@admin.register(User)
+class UserAdmin(auth_admin.UserAdmin):
+ form = UserAdminChangeForm
+ add_form = UserAdminCreationForm
+ fieldsets = (
+ (None, {"fields": ("email", "password")}),
+ (_("Personal info"), {"fields": ("name",)}),
+ (
+ _("Permissions"),
+ {
+ "fields": (
+ "is_active",
+ "is_staff",
+ "is_superuser",
+ "groups",
+ "user_permissions",
+ ),
+ },
+ ),
+ (_("Important dates"), {"fields": ("last_login", "date_joined")}),
+ )
+ list_display = ["email", "name", "is_superuser"]
+ search_fields = ["name"]
+ ordering = ["id"]
+ add_fieldsets = (
+ (
+ None,
+ {
+ "classes": ("wide",),
+ "fields": ("email", "password1", "password2"),
+ },
+ ),
+ )
diff --git a/pyblackbird_cc/users/apps.py b/pyblackbird_cc/users/apps.py
new file mode 100644
index 0000000..beec953
--- /dev/null
+++ b/pyblackbird_cc/users/apps.py
@@ -0,0 +1,13 @@
+import contextlib
+
+from django.apps import AppConfig
+from django.utils.translation import gettext_lazy as _
+
+
+class UsersConfig(AppConfig):
+ name = "pyblackbird_cc.users"
+ verbose_name = _("Users")
+
+ def ready(self):
+ with contextlib.suppress(ImportError):
+ import pyblackbird_cc.users.signals # noqa: F401
diff --git a/pyblackbird_cc/users/context_processors.py b/pyblackbird_cc/users/context_processors.py
new file mode 100644
index 0000000..e2633ae
--- /dev/null
+++ b/pyblackbird_cc/users/context_processors.py
@@ -0,0 +1,8 @@
+from django.conf import settings
+
+
+def allauth_settings(request):
+ """Expose some settings from django-allauth in templates."""
+ return {
+ "ACCOUNT_ALLOW_REGISTRATION": settings.ACCOUNT_ALLOW_REGISTRATION,
+ }
diff --git a/pyblackbird_cc/users/forms.py b/pyblackbird_cc/users/forms.py
new file mode 100644
index 0000000..fe8a886
--- /dev/null
+++ b/pyblackbird_cc/users/forms.py
@@ -0,0 +1,44 @@
+from allauth.account.forms import SignupForm
+from allauth.socialaccount.forms import SignupForm as SocialSignupForm
+from django.contrib.auth import forms as admin_forms
+from django.forms import EmailField
+from django.utils.translation import gettext_lazy as _
+
+from .models import User
+
+
+class UserAdminChangeForm(admin_forms.UserChangeForm):
+ class Meta(admin_forms.UserChangeForm.Meta):
+ model = User
+ field_classes = {"email": EmailField}
+
+
+class UserAdminCreationForm(admin_forms.UserCreationForm):
+ """
+ Form for User Creation in the Admin Area.
+ To change user signup, see UserSignupForm and UserSocialSignupForm.
+ """
+
+ class Meta(admin_forms.UserCreationForm.Meta):
+ model = User
+ fields = ("email",)
+ field_classes = {"email": EmailField}
+ error_messages = {
+ "email": {"unique": _("This email has already been taken.")},
+ }
+
+
+class UserSignupForm(SignupForm):
+ """
+ Form that will be rendered on a user sign up section/screen.
+ Default fields will be added automatically.
+ Check UserSocialSignupForm for accounts created from social.
+ """
+
+
+class UserSocialSignupForm(SocialSignupForm):
+ """
+ Renders the form when user has signed up using social accounts.
+ Default fields will be added automatically.
+ See UserSignupForm otherwise.
+ """
diff --git a/pyblackbird_cc/users/managers.py b/pyblackbird_cc/users/managers.py
new file mode 100644
index 0000000..d8beaa4
--- /dev/null
+++ b/pyblackbird_cc/users/managers.py
@@ -0,0 +1,42 @@
+from typing import TYPE_CHECKING
+
+from django.contrib.auth.hashers import make_password
+from django.contrib.auth.models import UserManager as DjangoUserManager
+
+if TYPE_CHECKING:
+ from .models import User # noqa: F401
+
+
+class UserManager(DjangoUserManager["User"]):
+ """Custom manager for the User model."""
+
+ def _create_user(self, email: str, password: str | None, **extra_fields):
+ """
+ Create and save a user with the given email and password.
+ """
+ if not email:
+ msg = "The given email must be set"
+ raise ValueError(msg)
+ email = self.normalize_email(email)
+ user = self.model(email=email, **extra_fields)
+ user.password = make_password(password)
+ user.save(using=self._db)
+ return user
+
+ def create_user(self, email: str, password: str | None = None, **extra_fields): # type: ignore[override]
+ extra_fields.setdefault("is_staff", False)
+ extra_fields.setdefault("is_superuser", False)
+ return self._create_user(email, password, **extra_fields)
+
+ def create_superuser(self, email: str, password: str | None = None, **extra_fields): # type: ignore[override]
+ extra_fields.setdefault("is_staff", True)
+ extra_fields.setdefault("is_superuser", True)
+
+ if extra_fields.get("is_staff") is not True:
+ msg = "Superuser must have is_staff=True."
+ raise ValueError(msg)
+ if extra_fields.get("is_superuser") is not True:
+ msg = "Superuser must have is_superuser=True."
+ raise ValueError(msg)
+
+ return self._create_user(email, password, **extra_fields)
diff --git a/pyblackbird_cc/users/migrations/0001_initial.py b/pyblackbird_cc/users/migrations/0001_initial.py
new file mode 100644
index 0000000..6f2c3fb
--- /dev/null
+++ b/pyblackbird_cc/users/migrations/0001_initial.py
@@ -0,0 +1,112 @@
+import django.contrib.auth.models
+import django.contrib.auth.validators
+import django.utils.timezone
+from django.db import migrations
+from django.db import models
+
+import pyblackbird_cc.users.models
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ("auth", "0012_alter_user_first_name_max_length"),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name="User",
+ fields=[
+ (
+ "id",
+ models.BigAutoField(
+ auto_created=True,
+ primary_key=True,
+ serialize=False,
+ verbose_name="ID",
+ ),
+ ),
+ ("password", models.CharField(max_length=128, verbose_name="password")),
+ (
+ "last_login",
+ models.DateTimeField(
+ blank=True, null=True, verbose_name="last login",
+ ),
+ ),
+ (
+ "is_superuser",
+ models.BooleanField(
+ default=False,
+ help_text="Designates that this user has all permissions without explicitly assigning them.",
+ verbose_name="superuser status",
+ ),
+ ),
+ (
+ "email",
+ models.EmailField(
+ unique=True, max_length=254, verbose_name="email address",
+ ),
+ ),
+ (
+ "is_staff",
+ models.BooleanField(
+ default=False,
+ help_text="Designates whether the user can log into this admin site.",
+ verbose_name="staff status",
+ ),
+ ),
+ (
+ "is_active",
+ models.BooleanField(
+ default=True,
+ help_text="Designates whether this user should be treated as active. Unselect this instead of deleting accounts.",
+ verbose_name="active",
+ ),
+ ),
+ (
+ "date_joined",
+ models.DateTimeField(
+ default=django.utils.timezone.now, verbose_name="date joined",
+ ),
+ ),
+ (
+ "name",
+ models.CharField(
+ blank=True, max_length=255, verbose_name="Name of User",
+ ),
+ ),
+ (
+ "groups",
+ models.ManyToManyField(
+ blank=True,
+ help_text="The groups this user belongs to. A user will get all permissions granted to each of their groups.",
+ related_name="user_set",
+ related_query_name="user",
+ to="auth.Group",
+ verbose_name="groups",
+ ),
+ ),
+ (
+ "user_permissions",
+ models.ManyToManyField(
+ blank=True,
+ help_text="Specific permissions for this user.",
+ related_name="user_set",
+ related_query_name="user",
+ to="auth.Permission",
+ verbose_name="user permissions",
+ ),
+ ),
+ ],
+ options={
+ "verbose_name": "user",
+ "verbose_name_plural": "users",
+ "abstract": False,
+ },
+ managers=[
+ ("objects", pyblackbird_cc.users.models.UserManager()),
+ ],
+ ),
+ ]
diff --git a/pyblackbird_cc/users/migrations/__init__.py b/pyblackbird_cc/users/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/pyblackbird_cc/users/migrations/__init__.py
diff --git a/pyblackbird_cc/users/models.py b/pyblackbird_cc/users/models.py
new file mode 100644
index 0000000..f536bc7
--- /dev/null
+++ b/pyblackbird_cc/users/models.py
@@ -0,0 +1,38 @@
+from typing import ClassVar
+
+from django.contrib.auth.models import AbstractUser
+from django.db.models import CharField
+from django.db.models import EmailField
+from django.urls import reverse
+from django.utils.translation import gettext_lazy as _
+
+from .managers import UserManager
+
+
+class User(AbstractUser):
+ """
+ Default custom user model for pyblackbird-cc.
+ If adding fields that need to be filled at user signup,
+ check forms.SignupForm and forms.SocialSignupForms accordingly.
+ """
+
+ # First and last name do not cover name patterns around the globe
+ name = CharField(_("Name of User"), blank=True, max_length=255)
+ first_name = None # type: ignore[assignment]
+ last_name = None # type: ignore[assignment]
+ email = EmailField(_("email address"), unique=True)
+ username = None # type: ignore[assignment]
+
+ USERNAME_FIELD = "email"
+ REQUIRED_FIELDS = []
+
+ objects: ClassVar[UserManager] = UserManager()
+
+ def get_absolute_url(self) -> str:
+ """Get URL for user's detail view.
+
+ Returns:
+ str: URL for user detail.
+
+ """
+ return reverse("users:detail", kwargs={"pk": self.id})
diff --git a/pyblackbird_cc/users/tasks.py b/pyblackbird_cc/users/tasks.py
new file mode 100644
index 0000000..ca51cd7
--- /dev/null
+++ b/pyblackbird_cc/users/tasks.py
@@ -0,0 +1,9 @@
+from celery import shared_task
+
+from .models import User
+
+
+@shared_task()
+def get_users_count():
+ """A pointless Celery task to demonstrate usage."""
+ return User.objects.count()
diff --git a/pyblackbird_cc/users/tests/__init__.py b/pyblackbird_cc/users/tests/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/pyblackbird_cc/users/tests/__init__.py
diff --git a/pyblackbird_cc/users/tests/factories.py b/pyblackbird_cc/users/tests/factories.py
new file mode 100644
index 0000000..5c83741
--- /dev/null
+++ b/pyblackbird_cc/users/tests/factories.py
@@ -0,0 +1,40 @@
+from collections.abc import Sequence
+from typing import Any
+
+from factory import Faker
+from factory import post_generation
+from factory.django import DjangoModelFactory
+
+from pyblackbird_cc.users.models import User
+
+
+class UserFactory(DjangoModelFactory):
+ email = Faker("email")
+ name = Faker("name")
+
+ @post_generation
+ def password(self, create: bool, extracted: Sequence[Any], **kwargs): # noqa: FBT001
+ password = (
+ extracted
+ if extracted
+ else Faker(
+ "password",
+ length=42,
+ special_chars=True,
+ digits=True,
+ upper_case=True,
+ lower_case=True,
+ ).evaluate(None, None, extra={"locale": None})
+ )
+ self.set_password(password)
+
+ @classmethod
+ def _after_postgeneration(cls, instance, create, results=None):
+ """Save again the instance if creating and at least one hook ran."""
+ if create and results and not cls._meta.skip_postgeneration_save:
+ # Some post-generation hooks ran, and may have modified us.
+ instance.save()
+
+ class Meta:
+ model = User
+ django_get_or_create = ["email"]
diff --git a/pyblackbird_cc/users/tests/test_admin.py b/pyblackbird_cc/users/tests/test_admin.py
new file mode 100644
index 0000000..5132d21
--- /dev/null
+++ b/pyblackbird_cc/users/tests/test_admin.py
@@ -0,0 +1,65 @@
+import contextlib
+from http import HTTPStatus
+from importlib import reload
+
+import pytest
+from django.contrib import admin
+from django.contrib.auth.models import AnonymousUser
+from django.urls import reverse
+from pytest_django.asserts import assertRedirects
+
+from pyblackbird_cc.users.models import User
+
+
+class TestUserAdmin:
+ def test_changelist(self, admin_client):
+ url = reverse("admin:users_user_changelist")
+ response = admin_client.get(url)
+ assert response.status_code == HTTPStatus.OK
+
+ def test_search(self, admin_client):
+ url = reverse("admin:users_user_changelist")
+ response = admin_client.get(url, data={"q": "test"})
+ assert response.status_code == HTTPStatus.OK
+
+ def test_add(self, admin_client):
+ url = reverse("admin:users_user_add")
+ response = admin_client.get(url)
+ assert response.status_code == HTTPStatus.OK
+
+ response = admin_client.post(
+ url,
+ data={
+ "email": "new-admin@example.com",
+ "password1": "My_R@ndom-P@ssw0rd",
+ "password2": "My_R@ndom-P@ssw0rd",
+ },
+ )
+ assert response.status_code == HTTPStatus.FOUND
+ assert User.objects.filter(email="new-admin@example.com").exists()
+
+ def test_view_user(self, admin_client):
+ user = User.objects.get(email="admin@example.com")
+ url = reverse("admin:users_user_change", kwargs={"object_id": user.pk})
+ response = admin_client.get(url)
+ assert response.status_code == HTTPStatus.OK
+
+ @pytest.fixture()
+ def _force_allauth(self, settings):
+ settings.DJANGO_ADMIN_FORCE_ALLAUTH = True
+ # Reload the admin module to apply the setting change
+ import pyblackbird_cc.users.admin as users_admin
+
+ with contextlib.suppress(admin.sites.AlreadyRegistered):
+ reload(users_admin)
+
+ @pytest.mark.django_db()
+ @pytest.mark.usefixtures("_force_allauth")
+ def test_allauth_login(self, rf, settings):
+ request = rf.get("/fake-url")
+ request.user = AnonymousUser()
+ response = admin.site.login(request)
+
+ # The `admin` login view should redirect to the `allauth` login view
+ target_url = reverse(settings.LOGIN_URL) + "?next=" + request.path
+ assertRedirects(response, target_url, fetch_redirect_response=False)
diff --git a/pyblackbird_cc/users/tests/test_forms.py b/pyblackbird_cc/users/tests/test_forms.py
new file mode 100644
index 0000000..0e4e17a
--- /dev/null
+++ b/pyblackbird_cc/users/tests/test_forms.py
@@ -0,0 +1,35 @@
+"""Module for all Form Tests."""
+
+from django.utils.translation import gettext_lazy as _
+
+from pyblackbird_cc.users.forms import UserAdminCreationForm
+from pyblackbird_cc.users.models import User
+
+
+class TestUserAdminCreationForm:
+ """
+ Test class for all tests related to the UserAdminCreationForm
+ """
+
+ def test_username_validation_error_msg(self, user: User):
+ """
+ Tests UserAdminCreation Form's unique validator functions correctly by testing:
+ 1) A new user with an existing username cannot be added.
+ 2) Only 1 error is raised by the UserCreation Form
+ 3) The desired error message is raised
+ """
+
+ # The user already exists,
+ # hence cannot be created.
+ form = UserAdminCreationForm(
+ {
+ "email": user.email,
+ "password1": user.password,
+ "password2": user.password,
+ },
+ )
+
+ assert not form.is_valid()
+ assert len(form.errors) == 1
+ assert "email" in form.errors
+ assert form.errors["email"][0] == _("This email has already been taken.")
diff --git a/pyblackbird_cc/users/tests/test_managers.py b/pyblackbird_cc/users/tests/test_managers.py
new file mode 100644
index 0000000..66cad8d
--- /dev/null
+++ b/pyblackbird_cc/users/tests/test_managers.py
@@ -0,0 +1,55 @@
+from io import StringIO
+
+import pytest
+from django.core.management import call_command
+
+from pyblackbird_cc.users.models import User
+
+
+@pytest.mark.django_db()
+class TestUserManager:
+ def test_create_user(self):
+ user = User.objects.create_user(
+ email="john@example.com",
+ password="something-r@nd0m!", # noqa: S106
+ )
+ assert user.email == "john@example.com"
+ assert not user.is_staff
+ assert not user.is_superuser
+ assert user.check_password("something-r@nd0m!")
+ assert user.username is None
+
+ def test_create_superuser(self):
+ user = User.objects.create_superuser(
+ email="admin@example.com",
+ password="something-r@nd0m!", # noqa: S106
+ )
+ assert user.email == "admin@example.com"
+ assert user.is_staff
+ assert user.is_superuser
+ assert user.username is None
+
+ def test_create_superuser_username_ignored(self):
+ user = User.objects.create_superuser(
+ email="test@example.com",
+ password="something-r@nd0m!", # noqa: S106
+ )
+ assert user.username is None
+
+
+@pytest.mark.django_db()
+def test_createsuperuser_command():
+ """Ensure createsuperuser command works with our custom manager."""
+ out = StringIO()
+ command_result = call_command(
+ "createsuperuser",
+ "--email",
+ "henry@example.com",
+ interactive=False,
+ stdout=out,
+ )
+
+ assert command_result is None
+ assert out.getvalue() == "Superuser created successfully.\n"
+ user = User.objects.get(email="henry@example.com")
+ assert not user.has_usable_password()
diff --git a/pyblackbird_cc/users/tests/test_models.py b/pyblackbird_cc/users/tests/test_models.py
new file mode 100644
index 0000000..33802cd
--- /dev/null
+++ b/pyblackbird_cc/users/tests/test_models.py
@@ -0,0 +1,5 @@
+from pyblackbird_cc.users.models import User
+
+
+def test_user_get_absolute_url(user: User):
+ assert user.get_absolute_url() == f"/users/{user.pk}/"
diff --git a/pyblackbird_cc/users/tests/test_tasks.py b/pyblackbird_cc/users/tests/test_tasks.py
new file mode 100644
index 0000000..6282bfb
--- /dev/null
+++ b/pyblackbird_cc/users/tests/test_tasks.py
@@ -0,0 +1,17 @@
+import pytest
+from celery.result import EagerResult
+
+from pyblackbird_cc.users.tasks import get_users_count
+from pyblackbird_cc.users.tests.factories import UserFactory
+
+pytestmark = pytest.mark.django_db
+
+
+def test_user_count(settings):
+ """A basic test to execute the get_users_count Celery task."""
+ batch_size = 3
+ UserFactory.create_batch(batch_size)
+ settings.CELERY_TASK_ALWAYS_EAGER = True
+ task_result = get_users_count.delay()
+ assert isinstance(task_result, EagerResult)
+ assert task_result.result == batch_size
diff --git a/pyblackbird_cc/users/tests/test_urls.py b/pyblackbird_cc/users/tests/test_urls.py
new file mode 100644
index 0000000..e5bdc25
--- /dev/null
+++ b/pyblackbird_cc/users/tests/test_urls.py
@@ -0,0 +1,19 @@
+from django.urls import resolve
+from django.urls import reverse
+
+from pyblackbird_cc.users.models import User
+
+
+def test_detail(user: User):
+ assert reverse("users:detail", kwargs={"pk": user.pk}) == f"/users/{user.pk}/"
+ assert resolve(f"/users/{user.pk}/").view_name == "users:detail"
+
+
+def test_update():
+ assert reverse("users:update") == "/users/~update/"
+ assert resolve("/users/~update/").view_name == "users:update"
+
+
+def test_redirect():
+ assert reverse("users:redirect") == "/users/~redirect/"
+ assert resolve("/users/~redirect/").view_name == "users:redirect"
diff --git a/pyblackbird_cc/users/tests/test_views.py b/pyblackbird_cc/users/tests/test_views.py
new file mode 100644
index 0000000..5ca13fc
--- /dev/null
+++ b/pyblackbird_cc/users/tests/test_views.py
@@ -0,0 +1,101 @@
+from http import HTTPStatus
+
+import pytest
+from django.conf import settings
+from django.contrib import messages
+from django.contrib.auth.models import AnonymousUser
+from django.contrib.messages.middleware import MessageMiddleware
+from django.contrib.sessions.middleware import SessionMiddleware
+from django.http import HttpRequest
+from django.http import HttpResponseRedirect
+from django.test import RequestFactory
+from django.urls import reverse
+from django.utils.translation import gettext_lazy as _
+
+from pyblackbird_cc.users.forms import UserAdminChangeForm
+from pyblackbird_cc.users.models import User
+from pyblackbird_cc.users.tests.factories import UserFactory
+from pyblackbird_cc.users.views import UserRedirectView
+from pyblackbird_cc.users.views import UserUpdateView
+from pyblackbird_cc.users.views import user_detail_view
+
+pytestmark = pytest.mark.django_db
+
+
+class TestUserUpdateView:
+ """
+ TODO:
+ extracting view initialization code as class-scoped fixture
+ would be great if only pytest-django supported non-function-scoped
+ fixture db access -- this is a work-in-progress for now:
+ https://github.com/pytest-dev/pytest-django/pull/258
+ """
+
+ def dummy_get_response(self, request: HttpRequest):
+ return None
+
+ def test_get_success_url(self, user: User, rf: RequestFactory):
+ view = UserUpdateView()
+ request = rf.get("/fake-url/")
+ request.user = user
+
+ view.request = request
+ assert view.get_success_url() == f"/users/{user.pk}/"
+
+ def test_get_object(self, user: User, rf: RequestFactory):
+ view = UserUpdateView()
+ request = rf.get("/fake-url/")
+ request.user = user
+
+ view.request = request
+
+ assert view.get_object() == user
+
+ def test_form_valid(self, user: User, rf: RequestFactory):
+ view = UserUpdateView()
+ request = rf.get("/fake-url/")
+
+ # Add the session/message middleware to the request
+ SessionMiddleware(self.dummy_get_response).process_request(request)
+ MessageMiddleware(self.dummy_get_response).process_request(request)
+ request.user = user
+
+ view.request = request
+
+ # Initialize the form
+ form = UserAdminChangeForm()
+ form.cleaned_data = {}
+ form.instance = user
+ view.form_valid(form)
+
+ messages_sent = [m.message for m in messages.get_messages(request)]
+ assert messages_sent == [_("Information successfully updated")]
+
+
+class TestUserRedirectView:
+ def test_get_redirect_url(self, user: User, rf: RequestFactory):
+ view = UserRedirectView()
+ request = rf.get("/fake-url")
+ request.user = user
+
+ view.request = request
+ assert view.get_redirect_url() == f"/users/{user.pk}/"
+
+
+class TestUserDetailView:
+ def test_authenticated(self, user: User, rf: RequestFactory):
+ request = rf.get("/fake-url/")
+ request.user = UserFactory()
+ response = user_detail_view(request, pk=user.pk)
+
+ assert response.status_code == HTTPStatus.OK
+
+ def test_not_authenticated(self, user: User, rf: RequestFactory):
+ request = rf.get("/fake-url/")
+ request.user = AnonymousUser()
+ response = user_detail_view(request, pk=user.pk)
+ login_url = reverse(settings.LOGIN_URL)
+
+ assert isinstance(response, HttpResponseRedirect)
+ assert response.status_code == HTTPStatus.FOUND
+ assert response.url == f"{login_url}?next=/fake-url/"
diff --git a/pyblackbird_cc/users/urls.py b/pyblackbird_cc/users/urls.py
new file mode 100644
index 0000000..56c246c
--- /dev/null
+++ b/pyblackbird_cc/users/urls.py
@@ -0,0 +1,12 @@
+from django.urls import path
+
+from .views import user_detail_view
+from .views import user_redirect_view
+from .views import user_update_view
+
+app_name = "users"
+urlpatterns = [
+ path("~redirect/", view=user_redirect_view, name="redirect"),
+ path("~update/", view=user_update_view, name="update"),
+ path("<int:pk>/", view=user_detail_view, name="detail"),
+]
diff --git a/pyblackbird_cc/users/views.py b/pyblackbird_cc/users/views.py
new file mode 100644
index 0000000..26876a1
--- /dev/null
+++ b/pyblackbird_cc/users/views.py
@@ -0,0 +1,45 @@
+from django.contrib.auth.mixins import LoginRequiredMixin
+from django.contrib.messages.views import SuccessMessageMixin
+from django.urls import reverse
+from django.utils.translation import gettext_lazy as _
+from django.views.generic import DetailView
+from django.views.generic import RedirectView
+from django.views.generic import UpdateView
+
+from pyblackbird_cc.users.models import User
+
+
+class UserDetailView(LoginRequiredMixin, DetailView):
+ model = User
+ slug_field = "id"
+ slug_url_kwarg = "id"
+
+
+user_detail_view = UserDetailView.as_view()
+
+
+class UserUpdateView(LoginRequiredMixin, SuccessMessageMixin, UpdateView):
+ model = User
+ fields = ["name"]
+ success_message = _("Information successfully updated")
+
+ def get_success_url(self):
+ # for mypy to know that the user is authenticated
+ assert self.request.user.is_authenticated
+ return self.request.user.get_absolute_url()
+
+ def get_object(self):
+ return self.request.user
+
+
+user_update_view = UserUpdateView.as_view()
+
+
+class UserRedirectView(LoginRequiredMixin, RedirectView):
+ permanent = False
+
+ def get_redirect_url(self):
+ return reverse("users:detail", kwargs={"pk": self.request.user.pk})
+
+
+user_redirect_view = UserRedirectView.as_view()
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..eba190f
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,171 @@
+# ==== pytest ====
+[tool.pytest.ini_options]
+minversion = "6.0"
+addopts = "--ds=config.settings.test --reuse-db --import-mode=importlib"
+python_files = [
+ "tests.py",
+ "test_*.py",
+]
+
+# ==== Coverage ====
+[tool.coverage.run]
+include = ["pyblackbird_cc/**"]
+omit = ["*/migrations/*", "*/tests/*"]
+plugins = ["django_coverage_plugin"]
+
+# ==== mypy ====
+[tool.mypy]
+python_version = "3.12"
+check_untyped_defs = true
+ignore_missing_imports = true
+warn_unused_ignores = true
+warn_redundant_casts = true
+warn_unused_configs = true
+plugins = [
+ "mypy_django_plugin.main",
+]
+
+[[tool.mypy.overrides]]
+# Django migrations should not produce any errors:
+module = "*.migrations.*"
+ignore_errors = true
+
+[tool.django-stubs]
+django_settings_module = "config.settings.test"
+
+# ==== djLint ====
+[tool.djlint]
+blank_line_after_tag = "load,extends"
+close_void_tags = true
+format_css = true
+format_js = true
+# TODO: remove T002 when fixed https://github.com/djlint/djLint/issues/687
+ignore = "H006,H030,H031,T002"
+include = "H017,H035"
+indent = 2
+max_line_length = 119
+profile = "django"
+
+[tool.djlint.css]
+indent_size = 2
+
+[tool.djlint.js]
+indent_size = 2
+
+[tool.ruff]
+# Exclude a variety of commonly ignored directories.
+exclude = [
+ ".bzr",
+ ".direnv",
+ ".eggs",
+ ".git",
+ ".git-rewrite",
+ ".hg",
+ ".mypy_cache",
+ ".nox",
+ ".pants.d",
+ ".pytype",
+ ".ruff_cache",
+ ".svn",
+ ".tox",
+ ".venv",
+ "__pypackages__",
+ "_build",
+ "buck-out",
+ "build",
+ "dist",
+ "node_modules",
+ "venv",
+ "*/migrations/*.py",
+ "staticfiles/*"
+]
+# Same as Django: https://github.com/cookiecutter/cookiecutter-django/issues/4792.
+line-length = 88
+indent-width = 4
+target-version = "py312"
+
+[tool.ruff.lint]
+select = [
+ "F",
+ "E",
+ "W",
+ "C90",
+ "I",
+ "N",
+ "UP",
+ "YTT",
+ # "ANN", # flake8-annotations: we should support this in the future but 100+ errors atm
+ "ASYNC",
+ "S",
+ "BLE",
+ "FBT",
+ "B",
+ "A",
+ "COM",
+ "C4",
+ "DTZ",
+ "T10",
+ "DJ",
+ "EM",
+ "EXE",
+ "FA",
+ 'ISC',
+ "ICN",
+ "G",
+ 'INP',
+ 'PIE',
+ "T20",
+ 'PYI',
+ 'PT',
+ "Q",
+ "RSE",
+ "RET",
+ "SLF",
+ "SLOT",
+ "SIM",
+ "TID",
+ "TCH",
+ "INT",
+ # "ARG", # Unused function argument
+ "PTH",
+ "ERA",
+ "PD",
+ "PGH",
+ "PL",
+ "TRY",
+ "FLY",
+ # "NPY",
+ # "AIR",
+ "PERF",
+ # "FURB",
+ # "LOG",
+ "RUF"
+]
+ignore = [
+ "S101", # Use of assert detected https://docs.astral.sh/ruff/rules/assert/
+ "RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
+ "SIM102", # sometimes it's better to nest
+ "UP038" # Checks for uses of isinstance/issubclass that take a tuple
+ # of types for comparison.
+ # Deactivated because it can make the code slow:
+ # https://github.com/astral-sh/ruff/issues/7871
+]
+# Allow fix for all enabled rules (when `--fix`) is provided.
+fixable = ["ALL"]
+unfixable = []
+# The fixes in extend-unsafe-fixes will require
+# provide the `--unsafe-fixes` flag when fixing.
+extend-unsafe-fixes = [
+ "UP038"
+]
+# Allow unused variables when underscore-prefixed.
+dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
+
+[tool.ruff.format]
+quote-style = "double"
+indent-style = "space"
+skip-magic-trailing-comma = false
+line-ending = "auto"
+
+[tool.ruff.lint.isort]
+force-single-line = true
diff --git a/requirements/base.txt b/requirements/base.txt
new file mode 100644
index 0000000..a7de0ef
--- /dev/null
+++ b/requirements/base.txt
@@ -0,0 +1,19 @@
+python-slugify==8.0.4 # https://github.com/un33k/python-slugify
+Pillow==10.3.0 # https://github.com/python-pillow/Pillow
+argon2-cffi==23.1.0 # https://github.com/hynek/argon2_cffi
+whitenoise==6.6.0 # https://github.com/evansd/whitenoise
+redis==5.0.4 # https://github.com/redis/redis-py
+hiredis==2.3.2 # https://github.com/redis/hiredis-py
+celery==5.4.0 # pyup: < 6.0 # https://github.com/celery/celery
+django-celery-beat==2.6.0 # https://github.com/celery/django-celery-beat
+flower==2.0.1 # https://github.com/mher/flower
+
+# Django
+# ------------------------------------------------------------------------------
+django==4.2.13 # pyup: < 5.0 # https://www.djangoproject.com/
+django-environ==0.11.2 # https://github.com/joke2k/django-environ
+django-model-utils==4.5.1 # https://github.com/jazzband/django-model-utils
+django-allauth[mfa]==0.62.1 # https://github.com/pennersr/django-allauth
+django-crispy-forms==2.1 # https://github.com/django-crispy-forms/django-crispy-forms
+crispy-bootstrap5==2024.2 # https://github.com/django-crispy-forms/crispy-bootstrap5
+django-redis==5.4.0 # https://github.com/jazzband/django-redis
diff --git a/requirements/local.txt b/requirements/local.txt
new file mode 100644
index 0000000..686a78d
--- /dev/null
+++ b/requirements/local.txt
@@ -0,0 +1,34 @@
+-r production.txt
+
+Werkzeug[watchdog]==3.0.2 # https://github.com/pallets/werkzeug
+ipdb==0.13.13 # https://github.com/gotcha/ipdb
+psycopg[c]==3.1.19 # https://github.com/psycopg/psycopg
+watchfiles==0.21.0 # https://github.com/samuelcolvin/watchfiles
+
+# Testing
+# ------------------------------------------------------------------------------
+mypy==1.7.1 # https://github.com/python/mypy
+django-stubs[compatible-mypy]==4.2.7 # https://github.com/typeddjango/django-stubs
+pytest==8.2.0 # https://github.com/pytest-dev/pytest
+pytest-sugar==1.0.0 # https://github.com/Frozenball/pytest-sugar
+
+# Documentation
+# ------------------------------------------------------------------------------
+sphinx==7.3.7 # https://github.com/sphinx-doc/sphinx
+sphinx-autobuild==2024.4.16 # https://github.com/GaretJax/sphinx-autobuild
+
+# Code quality
+# ------------------------------------------------------------------------------
+ruff==0.4.4 # https://github.com/astral-sh/ruff
+coverage==7.5.1 # https://github.com/nedbat/coveragepy
+djlint==1.34.1 # https://github.com/Riverside-Healthcare/djLint
+pre-commit==3.7.1 # https://github.com/pre-commit/pre-commit
+
+# Django
+# ------------------------------------------------------------------------------
+factory-boy==3.3.0 # https://github.com/FactoryBoy/factory_boy
+
+django-debug-toolbar==4.3.0 # https://github.com/jazzband/django-debug-toolbar
+django-extensions==3.2.3 # https://github.com/django-extensions/django-extensions
+django-coverage-plugin==3.1.0 # https://github.com/nedbat/django_coverage_plugin
+pytest-django==4.8.0 # https://github.com/pytest-dev/pytest-django
diff --git a/requirements/production.txt b/requirements/production.txt
new file mode 100644
index 0000000..9024883
--- /dev/null
+++ b/requirements/production.txt
@@ -0,0 +1,12 @@
+# PRECAUTION: avoid production dependencies that aren't in development
+
+-r base.txt
+
+gunicorn==22.0.0 # https://github.com/benoitc/gunicorn
+psycopg[c]==3.1.19 # https://github.com/psycopg/psycopg
+sentry-sdk==2.1.1 # https://github.com/getsentry/sentry-python
+
+# Django
+# ------------------------------------------------------------------------------
+django-storages[s3]==1.14.3 # https://github.com/jschneier/django-storages
+django-anymail[mailgun]==10.3 # https://github.com/anymail/django-anymail
diff --git a/tests/__init__.py b/tests/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/__init__.py
diff --git a/tests/test_merge_production_dotenvs_in_dotenv.py b/tests/test_merge_production_dotenvs_in_dotenv.py
new file mode 100644
index 0000000..c0e68f6
--- /dev/null
+++ b/tests/test_merge_production_dotenvs_in_dotenv.py
@@ -0,0 +1,34 @@
+from pathlib import Path
+
+import pytest
+
+from merge_production_dotenvs_in_dotenv import merge
+
+
+@pytest.mark.parametrize(
+ ("input_contents", "expected_output"),
+ [
+ ([], ""),
+ ([""], "\n"),
+ (["JANE=doe"], "JANE=doe\n"),
+ (["SEP=true", "AR=ator"], "SEP=true\nAR=ator\n"),
+ (["A=0", "B=1", "C=2"], "A=0\nB=1\nC=2\n"),
+ (["X=x\n", "Y=y", "Z=z\n"], "X=x\n\nY=y\nZ=z\n\n"),
+ ],
+)
+def test_merge(
+ tmp_path: Path,
+ input_contents: list[str],
+ expected_output: str,
+):
+ output_file = tmp_path / ".env"
+
+ files_to_merge = []
+ for num, input_content in enumerate(input_contents, start=1):
+ merge_file = tmp_path / f".service{num}"
+ merge_file.write_text(input_content)
+ files_to_merge.append(merge_file)
+
+ merge(output_file, files_to_merge)
+
+ assert output_file.read_text() == expected_output