` elements from `top_nav.html` on Bootstrap builds. * Don’t include Docker translation instructions in README if not using Docker. (Thanks Peter for reporting!) * Updated the Pegasus CLI to [version 0.8](https://github.com/saaspegasus/pegasus-cli/releases/tag/v0.8), which fixes a bad html closing tag in the generated templates. (Thanks Julian for the bugfix!) * Removed celery sections from `deploy.yml` in kamal builds if celery isn’t enabled. ### Removed [Section titled “Removed”](#removed) * Removed `django_otp` dependency and configuration, which was only there to facilitate the transition to `allauth.mfa`. See the release notes for [Version 2024.5](#version-20245) for more information on this change. * Also removed the associated `migrate_allauth_2fa` management command. * Removed the default user-facing messages on login/logout. You can add them back or customize them by editing the files in `/templates/account/messages/`. ### Documentation [Section titled “Documentation”](#documentation) * Added [a community guide on using Digital Ocean Spaces](/community/digital-ocean-spaces) (alongside Amazon SES). Thanks Neil and Finbar for the contribution! ### Upgrading [Section titled “Upgrading”](#upgrading-4) Tailwind projects that have added their own `.sass` files will need to either restore sass support or port these files to `.css` (llms are good at this!). You can “restore” sass support by rejecting the proposed changes in `package.json` and `webpack.config.js` during upgrade. If you have removed Redis from your project you will need to update the default cache config in `settings.py`. *Feb 28, 2025* ## Version 2025.1.1 [Section titled “Version 2025.1.1”](#version-202511) This is a hotfix release that fixes an issue with installing Node 22 in the development Docker container. Thanks Oscar and Emiliano for reporting! If you’d rather manually apply the patch, you can just apply the following patch to your `Dockerfile.dev` file: ```diff RUN --mount=target=/var/lib/apt/lists,type=cache,sharing=locked \ --mount=target=/var/cache/apt,type=cache,sharing=locked \ rm -f /etc/apt/apt.conf.d/docker-clean && \ echo "deb https://deb.nodesource.com/node_22.x bookworm main" > /etc/apt/sources.list.d/nodesource.list && \ wget -qO- https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \ curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \ apt-get update && \ apt-get install -yqq nodejs \ ``` *Jan 28, 2025* ## Version 2025.1 [Section titled “Version 2025.1”](#version-20251) This release includes mostly backend infrastructure changes to some Pegasus features to pave the way for a (future) plugin ecosystem. This should make it easier to maintain Pegasus apps as well as possible (in the future) for other people to develop apps that can seamlessly integrate into Pegasus. ### New “async” build flag [Section titled “New “async” build flag”](#new-async-build-flag) Previously when you enabled async / websockets, you also got the group chat example application. Now you can enable async features without this additional example app, and turn it on separately with a new configuration option. This lets you use async but not have to manually delete the example application. ### Added a flag to remove Celery (if possible) [Section titled “Added a flag to remove Celery (if possible)”](#added-a-flag-to-remove-celery-if-possible) Added a configuration option that will remove celery and all dependencies + configuration ***if no other parts of your application need it***. Celery will also be removed from production deployment configurations. Celery is still required (and will be automatically enabled) if you are using any of: 1. The Pegasus examples 2. Subscriptions with per-unit billing enabled 3. Any AI chat features If you’re not using these features and want to disable Celery you can do that from your project settings page. ### Organizational changes to apps for more consistency [Section titled “Organizational changes to apps for more consistency”](#organizational-changes-to-apps-for-more-consistency) The following changes don’t have any new features or functionality, but change small things about how the code is organized for affected apps (AI chat, AI images, and async group chat). It is hoped that these changes will make maintenance, upgrades, and future extensions to Pegasus easier. Changes affecting the AI Chat, AI Images, and Group Chat apps: * Moved app declarations for these apps to the end of `PROJECT_APPS` in `settings.py` * Moved url declarations for these apps to the end of `urls.py`. * Moved settings and environment variables for these apps to be located together. * Settings for these apps are now prefixed with `AI_CHAT_` or `AI_IMAGES_`, respectively. * **This also means that shared settings like `OPENAI_API_KEY` are now declared multiple times and need to be updated in multiple places.** See the “upgrading” section below on how to get around this duplication. * Moved chat JavaScript setup to the end of `module.exports` in `webpack.config.js`. * Depending on your configuration, the order of navigation tabs in the UI may change. * Made minor tweaks to how channels urls are set up. * Image logos used by the AI chat and images apps were moved to `/static../../assets/images/ai_../../assets/images/` and `/static../../assets/images/ai_../../assets/images/`, respectively. * The declaration for these apps has moved to a new “plugins” section of `pegasus-config.yml`. ### Other Changes [Section titled “Other Changes”](#other-changes) Other changes included in this release are below. **Changed** * **Upgraded default Python to Python 3.12.** * Bumped the Python version to 3.12 in CI, and dev/production Docker containers. * Also added [a `.python-version` file](https://docs.astral.sh/uv/concepts/python-versions/#python-version-files) for uv builds (set to 3.12) * **Upgraded default Node to 22.** * Bumped the Node version to 22 in CI, and dev/production Docker containers. * **Upgraded nearly all Python packages to their latest versions.** * Added a pin to `dj-stripe<2.9` because 2.9 is not yet supported. * **Upgraded nearly all JavaScript packages to their latest versions.** * Tailwind v4 was not upgraded as it was just released and is not yet supported. * **Ruff and pre-commit will now sort imports by default.** (See upgrade notes below) * **This also updates import sorting in a number of files.** * **Pre-commit now runs ruff with `--fix` enabled, which will automatically apply (but not stage) fixable errors.** * Dependencies are now sorted in `pyproject.toml` (uv builds) and `requirements.in` (pip-tools builds) * Added email address to admin search for team memberships and invitations. Thanks EJ for the suggestion! * Made the “timezone” field editable in the user admin. Thanks Peter for the suggestion! * Changed active tab variable for ai image app from “ai\_images” to “ai-images” to match convention of other apps. * Added a link from the user profile to manage email addresses if the user has more than one email registered. (Thanks Simon for the suggestion!) * Make it so that `./manage.py` commands default to `uv run` if you build with uv enabled. * The `chat_tags` template tag library was moved to the `web` app and renamed to `markdown_tags`, making it easier to use outside the chat application. **Fixed** * **Fixed an issue that caused Render deployments to fail when using uv.** (Thanks Jacob for reporting and helping fix!) * Add `psycopg2-binary` to production requirements if using sqlite, since it still required for production deployments. (Thanks Randall for reporting!) * Updated invitations to always store email addresses in lowercase to be consistent with account emails. Also fixed comparisons between invitations and sign up emails to be case-insensitive. (Thanks EJ for reporting and the fix!) * Renamed `tailwind.config.js` to `tailwind.config.cjs` which prevents build failures on Node 22. **Removed** * Removed no-longer-used `payments.js` and `stripe.sass` files. * Stopped including `pip-tools` in `dev-requirements` when using `uv`, as it is no longer needed. ### Upgrading [Section titled “Upgrading”](#upgrading-5) **Python / Node updates** You may need to manually modify your dev/production environment to upgrade to Python 3.12 and Node 22. If you’re using Docker, this should happen automatically by following the [upgrade process](/upgrading). Pegasus apps should still run on Python 3.11 / Node 20, but will no longer be extensively tested on those versions moving forwards. **Settings Changes** Some settings around AI API keys have been renamed and will need to be updated in your `settings.py` and `.env` files. If you are using AI chat and AI images with OpenAI, the easiest way to use a shared API key is to add the following to your `.env` / environment variables: ```plaintext OPENAI_API_KEY="sk-***" ``` And then modify your settings variables to read from that value: ```python # add an OPENAI_API_KEY setting, in case it was referenced elsewhere in your code OPENAI_API_KEY = env("OPENAI_API_KEY", default="") # modify the image/chat settings to use the same openai key instead of reading from new environment variables AI_IMAGES_OPENAI_API_KEY = OPENAI_API_KEY AI_CHAT_OPENAI_API_KEY = OPENAI_API_KEY ``` **Import Sorting Changes** If you have auto-formatting enabled you will likely get CI errors after upgrading due to the stricter import sorting. You can fix these by running a manual ruff check locally and then committing the result: ```plaintext ruff check --fix # or with uv uv run ruff check --fix ``` *Jan 27, 2025* ## Version 2024.12.1 [Section titled “Version 2024.12.1”](#version-2024121) This is a minor hotfix release for 2024.12 * **Fixed a bug where the delete workflow was broken for apps created by the Pegasus CLI on non-Tailwind builds.** This happened becasue the “css\_framework” cli option was accidentally missing from `pegasus-config.yml`. Thanks Robert for reporting! * Updated the README instructions for setting up pre-commit hooks when using uv. *Jan 13, 2025* ## Version 2024.12 [Section titled “Version 2024.12”](#version-202412) content/ This release adds first-class support for using uv as a complete replacement for development and production workflows (see below), and has a handful of fixes/changes. ### UV support! [Section titled “UV support!”](#uv-support) This release adds full support for [uv](https://docs.astral.sh/uv/) as a replacement package manager for your project. You can use uv by selecting the new “uv” as your “Python package manager” on your project settings page. When you select uv the following changes will be made: * All requirements.in / requirements.txt files are removed. * Your project requirements will now be listed in your `pyproject.toml` file. * Development and production dependencies will be listed under separate dependency-groups. * Your pinned project requirements will be listed in a new `uv.lock` file. * Docker containers (in development and production) will use `uv` to set up and manage the Python environment. * A `make uv` target will be added to Docker builds to run `uv` commands in your container. The main benefits of using uv are: * Speed. It is just way, way faster to anything related to package management. * Easier to setup and install Python. * Lock files (pinned versions) are consistent across any platform. * More tooling. * Speed. (It’s so fast we put it twice.) There will be a longer write up about uv released very soon, but in the meantime you can review the updated [python documentation](/python/setup) and new [uv documentation](/python/uv). The rest of the docs have been updated to accommodate uv, though it’s possible there are some places that were missed. If you spot any issues in the docs, get in touch! ### Other fixes [Section titled “Other fixes”](#other-fixes) * **Upgraded the pegasus cli to fix an issue where the generated list views were not properly scoped to the appropriate team / user.** If you used the CLI to generate any apps it’s highly recommended that you check that you are not exposing objects that should not be viewable. ### Other updates [Section titled “Other updates”](#other-updates-3) * **Changed the default set up of social logins to use settings-based configuration instead of `SocialApps` in the database.** See the upgrade notes if you are using social logins to prevent issues. Thanks Alex for the suggestion and for helping with the updated documentation! * Updated the default flowbite setup to disable the forms plugin. This was causing styling conflicts with the default DaisyUI styles on certain form elements, including checkboxes. * Re-formatted the default form input template for readability. ### Upgrading [Section titled “Upgrading”](#upgrading-6) To migrate an existing project to `uv` see [this guide](/cookbooks/#migrating-from-pip-tools-to-uv). If your application was already using social logins defined in the database, the new settings-based declaration will conflict and cause errors on social login. To fix this you can either delete the `APPS` section of the relevant service in `settings.SOCIALACCOUNT_PROVIDERS`, or you can move the credentials into your project environment (e.g. `.env`) and delete relevant the `SocialApp` from the Django admin. *November 29, 2024* ## Version 2024.11.3 [Section titled “Version 2024.11.3”](#version-2024113) This is a minor maintenance release with a few changes in preparation for adding `uv` support (coming soon!). ### Changed [Section titled “Changed”](#changed-3) * Pinned the version of `uv` used in CI and Dockerfiles. * Added `venv` and `.venv` directories to the `.dockerignore` file and `make translations` target. * The `make requirements` command now restarts containers in the background, making it easier to combine with other make targets. * Added a catch-all to the `Makefile` to prevent error messages when running `make npm-install
` and similar commands. * Updated README commands to consistently use `python manage.py` instead of just `./manage.py`. * Made some minor formatting changes to `pyproject.toml`. * Fixed the link to the multi-stage dockerfile docs in `Dockerfile.web` * Upgraded a number of Python packages. * Updated the `default_stages` of the `.pre-commit-config.yaml` file to the latest expected format (`pre-commit`). *Nov 21, 2024* ## Version 2024.11.2 [Section titled “Version 2024.11.2”](#version-2024112) This release adds the ability to disable dark mode on Tailwind, upgrades front end libraries, bumps the API client version, and has a handful of other small changes and fixes. ## Added [Section titled “Added”](#added-2) * **Added a new build option to disable dark mode for Tailwind builds.** (Thanks Arno for suggesting!) * Added basic user-facing error messages to the standalone front end sign up and login workflows. ## Changed [Section titled “Changed”](#changed-4) * **Upgraded all JavaScript dependencies.** * **Updated the API client to use the latest version 7.9.0, and updated the standalone front end to work with the latest changes.** * Updated template-partials installation to be manually loaded, to allow for easier integration with other templating systems like django-cotton. * Moved active tab highlighting to the base view in the example object demo. * Made a few very minor edits to comments and whitespace in a few places. ## Fixed [Section titled “Fixed”](#fixed-3) * Fixed a bug where your migrations and tests would fail if your project name was > 50 characters (thanks Bernard for reporting!). * Fixed a bug in the group chat demo where submitting an empty room name would take you to a 404 page. * The `docker_startup.sh` file is no longer included if you are not using a docker-based deploy platform. * Updated the `config/README` file which had outdated information that predated the migration to Kamal 2. (Thanks Arno for reporting!) * Improved comments in the kamal `secrets` file and `.env` files. (Thanks Arno for suggesting!) ## Removed [Section titled “Removed”](#removed-1) * The `.env` file is no longer included in zip downloads. This file was already removed from Github builds so this just makes the two consistent. Projects should create `.env` file from the `.env.example` file. * Removed the `migrate_customers_to_teams` management command. This was added for an upgrade two years ago, and is assumed to be no longer needed. *Nov 14 2024* ## Version 2024.11.1 [Section titled “Version 2024.11.1”](#version-2024111) This is a minor hotfix release. ### Fixed [Section titled “Fixed”](#fixed-4) * Fixed an issue where the team selector was accidentally transparent in Tailwind builds. * Removed shadcn template that was accidentally included even if shadcn was disabled. ### Updated [Section titled “Updated”](#updated) * Removed extra whitespace from `form_tags.py`. (Thanks Brennon for reporting!) * Updated `make help` to allow for commands defined in `custom.mk` with digits to also show up. (Thanks Arno for suggesting!) *Nov 4 2024* ## Version 2024.11 [Section titled “Version 2024.11”](#version-202411) This is a feature release with an emphasis on improving the Tailwind CSS experience with Pegasus. Watch the video below for a demo, or read on for the highlights. ### Dark mode improvements [Section titled “Dark mode improvements”](#dark-mode-improvements) A dark mode selector was added to the navigation, allowing users to easily toggle between light, dark, and “system default” mode. The user’s selection is preserved server-side in the session object, which also helps to prevent flickering across page loads. ### Better Theme Support [Section titled “Better Theme Support”](#better-theme-support) It’s now easier than ever to change your project’s theme. Each project now supports a default light and dark theme which will be used throughout the site. The default themes need only be changed in `tailwind.config.js`, and `settings.py` and everything else is taken care of. See the updated [tailwind theme documentation](/css/tailwind/#changing-your-themes) for more details. ### New shadcn integration and demo dashboard [Section titled “New shadcn integration and demo dashboard”](#new-shadcn-integration-and-demo-dashboard) A new build setting allows you to build your project with [shadcn/ui](https://ui.shadcn.com/) installed. Shadcn is a great and versatile component library for React and Tailwind, but it is difficult to integrate it into a Django project without building a separate front end. Now Pegasus takes care of that integration for you, and provides a reference dashboard implementation of how to work with the library. The reference dashboard is a hybrid single-page React app served by Django. It uses the same colors as the DaisyUI theme, and will update when you change your theme, and has many interactive components. However, it is not connected to any backend data—it is just a UI example. Read more in the [shadcn docs here](/css/tailwind/#shadcn). ### New flowbite integration and demo component page [Section titled “New flowbite integration and demo component page”](#new-flowbite-integration-and-demo-component-page) Another new build setting allows you to build your project with [flowbite](https://flowbite.com/) installed. Flowbite is another great component library for Tailwind and does *not* use React---making it a great fit for htmx projects. If you enable this setting, flowbite will automatically be installed and you can drop flowbite components into any Django template. The reference page has an example of a few of these components. Read more in the [flowbite docs here](/css/tailwind/#flowbite). ### Other updates [Section titled “Other updates”](#other-updates-4) * **Upgraded all Python packages to their latest versions.** * **[uv](https://docs.astral.sh/uv/) is now used to install Python packages in Docker files and Github actions.** * Also updated `make pip-compile` target to use `uv`. * This resulted in minor changes to all `requirements.txt` files. * **Team invitation pages now prompt a user to log in instead of sign up if the email is associated with a known account.** (Thanks Daniel for suggesting!) * Your configured Github username, if available, will be used in a few places instead of a default value. (Thanks Richard for suggesting!) * Added `bg-base-100` to the `` tag of the base template and removed it from other components where it was now redundant. This improves theming support when themes heavily modify the base color. (Tailwind builds only) * Added equals signs to `ENV` declarations in production Docker files, for consistency. (Thanks Denis for suggesting!) * Slightly improved the styling of the e-commerce app. * Overhauled the [Tailwind CSS documentation](/css/tailwind). **Updates to the CLI ([release notes](https://github.com/saaspegasus/pegasus-cli/releases))** * Fixed a bug on certain environments where the `pegasus` command conflicted with a local `pegasus` folder, causing import errors running the CLI. * Apps created with `startapp` now use a `POST` for deletion instead of a `GET`. * Deletion now includes a modal confirmation (Tailwind and Bulma builds only). ### Upgrading [Section titled “Upgrading”](#upgrading-7) If you’re using Docker the `make upgrade` command won’t work out-of-the-box due to the change in how requirements files are managed. You will first have to rebuild your containers with: ```bash make build ``` or ```bash docker compose build ``` After that, you should be able to run `make upgrade` as normal. *Nov 1, 2024* ## Version 2024.10 [Section titled “Version 2024.10”](#version-202410) This release upgrades Kamal deployment to Kamal 2 and dramatically simplifies the Kamal deployment process. ### Kamal 2 deployment and related changes [Section titled “Kamal 2 deployment and related changes”](#kamal-2-deployment-and-related-changes) In the upgrade to Kamal 2, the following changes were made: * Updated Kamal to run from the root project directory instead of the `deploy` subdirectory. * Also moved the config file was also moved from `deploy/config/deploy.yml` to `config/deploy.yml` * Moved environment secrets from `deploy/.env` to `.kamal/secrets` to match Kamal 2’s recommendation. * Kamal can now be installed and run with Docker without any additional workarounds [as described here](https://kamal-deploy.org/docs/installation/) The custom docker set up instructions have been removed. * Kamal is now run as root by default, which dramatically simplifies the server setup process. There is now no need to run any manual steps to set up your server. * Kamal now creates and manages its own docker network. * Traefik has been dropped in favor of `kamal-proxy` for the proxy server, as per the new Kamal defaults. * The `.gitignore` and `.dockerignore` files were updated to reflect the new structure. * Added `apps.web.middleware.healthchecks.HealthCheckMiddleware` to workaround Kamal health checks and Django security features, [as outlined here](https://github.com/basecamp/kamal/issues/992#issuecomment-2381122195). * Removed unnecessary media directory set up from `Dockerfile.web`. It is recommended to use an external storage service for media files and not the Docker container. In addition, there were a few changes that affect projects that aren’t using Kamal: * `apps.web.locale_middleware` was moved to `apps.web.middleware.locale` * `docker_startup.sh` was moved from the `deploy` folder to the project root. The [Kamal documentation](/deployment/kamal) has been updated to reflect these changes. ### Other fixes [Section titled “Other fixes”](#other-fixes-1) * **Subscriptions in a “past due” state are now treated as “active” for the purposes of feature gating and accessing the billing portal.** This is more consistent with [how Stripe treats subscriptions in this state](https://docs.stripe.com/api/subscriptions/object#subscription_object-status). (Thanks Luc for suggesting!) * Fixed a bug where several `make` targets mistakenly included a `--no-deps` flag which would fail if your database container was not running. (Thanks Gary for reporting!) * Fixed an issue where Stripe subscription webhooks weren’t properly handled if you were using the embedded Stripe pricing table. (Thanks Andrew for reporting!) * Fixed an issue introduced in 2024.9 where Stripe ecommerce webhooks weren’t always processed correctly. * Added a migration file to automatically work around [this dj-stripe issue](https://github.com/dj-stripe/dj-stripe/issues/2038) so that it wasn’t a manual process. *Oct 15, 2024* ## Version 2024.9.3 [Section titled “Version 2024.9.3”](#version-202493) This release is mainly [an update to the CLI](https://github.com/saaspegasus/pegasus-cli/releases/tag/v0.3): ### CLI updates [Section titled “CLI updates”](#cli-updates) * **You can now generate apps that work seamlessly with Pegasus teams** (will use `BaseTeamModel` and add the team slug and permissions checks to all urls and views). * The CLI now generates a default `admin.py` config for each data model. * User foreign keys now use `settings.AUTH_USER_MODEL` instead of being hardcoded to `apps.users.models.CustomUser`. ### Other changes [Section titled “Other changes”](#other-changes-1) * Fixed an issue where HTMX links without href tags weren’t showing a pointer cursor on some CSS frameworks. * Add default region to Redis and Postgres configurations in `render.yaml` to make it easier to find/replace them when changing your project’s region. (Thanks Jacob for suggesting!) *Sep 26, 2024* ## Version 2024.9.2 [Section titled “Version 2024.9.2”](#version-202492) This release fixes a bug that prevented the CLI from running on Windows machines. Thanks Jonathan for reporting! If you don’t want to upgrade you can just `pip install pegasus-cli==0.2.1` to apply the fix. *Sep 20, 2024* ## Version 2024.9.1 [Section titled “Version 2024.9.1”](#version-202491) This release fixes a few things in the 2024.9 release. * Updated the `bootstrap_ecommerce` management command to create `ProductConfiguration` objects for all active Products in Stripe. * Fixed an issue on the ecommerce homepage where a closing ` ` tag was misplaced if a product didn’t have a default price set. *Sep 18, 2024* ## Version 2024.9 [Section titled “Version 2024.9”](#version-20249) There are two big updates in this release: 1. The Pegasus CLI, which allows you to instantly spin up new apps. 2. E-Commerce/Payments improvements. ### The Pegasus CLI [Section titled “The Pegasus CLI”](#the-pegasus-cli) The [Pegasus CLI](https://github.com/saaspegasus/pegasus-cli/) is a standalone command-line tool that allows you to instantly spin up new Django apps. You can specify as many data models as you want and it will generate a starting CRUD interface for each of them. Here’s a quick demo: **At the moment the CLI only supports HTMX build of Pegasus.** A React-based implementation is planned for a future date. Huge thanks to Peter for his excellent [Pegasus example apps](https://github.com/pcherna/pegasus-example-apps-v2) project which served as a reference for implementing the CRUD application and pagination. ### E-Commerce / Payments demo improvements [Section titled “E-Commerce / Payments demo improvements”](#e-commerce--payments-demo-improvements) This is a series of updates designed to make it easier to build a functional end-to-end application on top of the e-commerce demo. * Added a `ProductConfiguration` model to attach additional metadata to products. * E-Commerce product URLs and views now use the `ProductConfiguration` `slug` field instead of the Stripe Product IDs. * Added a `@product_required` decorator that can be used to restrict access to views based on whether the user has purchased a product. * Added a demo “access product” page that shows how to use the `@product_required` decorator. * Added `user_owns_product` and `get_valid_user_purchase` helper functions. * Improved the navigation and use of breadcrumbs in the demo UI. * **See upgrade notes for information about migrating previous data to the new set up.** See also: the updated [Payments docs](/payments). ### Other Changes [Section titled “Other Changes”](#other-changes-2) #### Added [Section titled “Added”](#added-3) * **Added `django-htmx` and `django-template-partials` as first-class dependencies to HTMX builds.** These libraries are used by the CLI and will be used for more HTMX-based functionality moving forwards. * Added `make manage` command to run arbitrary `manage.py` commands in a docker environment. E.g. `make manage ARGS='createsuperuser'`. * Added the ability to pass arguments to `make test` in docker. E.g. `make tests ARGS='apps.teams --keepdb'`. (Thanks David for the suggestion!) #### Changed [Section titled “Changed”](#changed-5) * Changed links on the tailwind signup page to use `pg-link` class instead of explict tailwind classes. (Thanks Peter for the suggestion!) * Silenced extraneous djstripe warnings when running tests. (Thanks Chris for the suggestion!) * Added `.vscode` and vs workspace files to the project `.gitignore`. * Switched from `assert` statements to `raise ValueError` in the e-commerce Stripe checkout confirmation view. * Moved some of the currency helper functions out of the `subscriptions` app into `utils.billing` so they can be used in ecommerce workflows even if subscriptions are disabled. * Set `PYTHONUNBUFFERED` and `PYTHONDONTWRITEBYTECODE` in docker compose file for python containers. (Thanks Richard for the suggestion!) * Upgraded Django to 5.1.1. #### Fixed [Section titled “Fixed”](#fixed-5) * Fixed a typo in the help text for the `bootstrap_ecommerce` command. * Fixed a bug where `user_teams` context processor could cause a crash if auth middeware didn’t run (for example, on a 500 error page in production). ### Upgrade Notes [Section titled “Upgrade Notes”](#upgrade-notes) If you have existing `Purchase` data in your application you will need to migrate it to the new `ProductConfiguration` structure. This is a three-step process: First you will need to apply the database updates, but allow `Purchase.product_configuration` to be null. Instead of running `./manage.py migrate` you will have to run the following command: ```bash ./manage.py migrate ecommerce 0002 ``` After running this, you can run the following command to migrate the existing data: ```bash ./manage.py migrate_ecommerce ``` The `migrate_ecommerce` management command will: 1. Create `ProductConfiguration` objects for all products in `settings.ACTIVE_ECOMMERCE_PRODUCT_IDS` 2. Create `ProductConfiguration` objects for all products referenced in existing `Purchase` models. 3. Set `purchase.product_configuration` to the new `ProductConfiguration` object for each `Purchase`. Finally, you can make the `Purchase.product_configuration` field non-null, by running: ```bash ./manage.py migrate ecommerce 0003 ``` **New projects, or projects without any existing purchase data can skip these steps and run `./manage.py migrate` directly.** However, you may still want to run `./manage.py migrate_ecommerce` to populate `ProductConfiguration` objects for your active products. *Sep 17, 2024* ## Version 2024.8.2 [Section titled “Version 2024.8.2”](#version-202482) This is a maintenance release that includes a number of mostly small fixes and updates, and updates Django to version 5.1. ### Fixed [Section titled “Fixed”](#fixed-6) * **Fixed a few styling issues on Bulma builds**: * Disabled dark mode. The styling for Dark mode was not fully supported by Bulma and led to strange-looking layouts. * Fixed an issue where the active tab wasn’t properly highlighted in certain cases on Bulma builds. * Fixed an issue with sqlite builds where the default `DATABASE_URL` would cause the DB to switch to Postgres. (Thanks Harry and Richard for reporting!) * Switched allauth from [Twitter](https://docs.allauth.org/en/latest/socialaccount/providers/twitter.html) (which seems no longer supported) to [Twitter Oauth2](https://docs.allauth.org/en/latest/socialaccount/providers/twitter_oauth2.html), which still works. (Thanks Bandi for reporting!) * Fixed an issue introduced in version 2024.8 which caused Heroku Docker deploys to fail. Heroku [does not support caching](https://stackoverflow.com/a/78901250/8207), so it has been removed from Heroku Docker builds. (Thanks Richard for reporting!) * Fixed a bug where the `team_nav_items.html` and `team_selector.html` templates could be accidentally included even if you built without teams. * Changed the (unused) `text-muted` css class to `pg-text-muted` in a handful of places on Tailwind builds. (Thanks Peter for reporting!) * Removed unused `AWS_S3_CUSTOM_DOMAIN` variable from `.env` files. ### Changed [Section titled “Changed”](#changed-6) * **Upgraded Django to version 5.1.** * Upgraded all Python packages to their latest versions. * Updated Pegasus color CSS variables to use the DaisyUI variables, so that they change when you change DaisyUI themes. (Thanks Peter for the suggestion!) * Removed `custom.mk` if your project was not generated with a `Makefile`. (Thanks Finbar for reporting!) * Removed “Containers started” message from `make start` command that never executed. (Thanks Richard for reporting!) * Better style inputs of type `time` and `datetime-local` in forms on all CSS frameworks. (Thanks Peter for reporting and fixing!) * Simplified Bulma navbar to use bulma native classes instead of custom CSS. (See upgrade note below.) * Updated default Github repo in `app-spec.yml` to use raw project slug instead of the hyphenated version. (Digital Ocean deployments, only, thanks Richard for suggesting) * Moved `SERVER_EMAIL` and `DEFAULT_FROM_EMAIL` from `settings_production.py` to main `settings.py` file, and made it possible to set them via the environment/`.env` file. * Added many more common settings and secrets to the Kamal `deploy.yml` file. ### Documentation [Section titled “Documentation”](#documentation-1) * Improved the documentation on [customizing the Material Bootstrap theme](/css/material). * Added documentation for [deploying multiple apps to the same VPS with Kamal](/deployment/kamal/#cookbooks). ### Upgrading [Section titled “Upgrading”](#upgrading-8) * Bulma builds may need to add the `is-tab` class to `navbar-items` in the top nav to mimic the updated navbar styling. *August 23, 2024* ## Version 2024.8.1 [Section titled “Version 2024.8.1”](#version-202481) This is a maintenance release which upgrades HTMX to version 2.0 and fixes a handful of minor bugs. ### Changed [Section titled “Changed”](#changed-7) * **Upgraded HTMX to [version 2.0](https://htmx.org/posts/2024-06-17-htmx-2-0-0-is-released/).** See upgrade note below. ### Fixed [Section titled “Fixed”](#fixed-7) * Fixed a bug on some environments where `make build-api-client` would wrong relative to the wrong directory. (Thanks Ben for finding and fixing!) * Downgraded Postgres from 16 to 14 on Digital Ocean deployments, due to [an issue with permissions on version 16](https://www.digitalocean.com/community/questions/how-can-i-create-a-postgres-16-user-that-has-permission-to-create-tables-on-an-app-platform-dev-database) that was causing new Digital Ocean deployments to fail. (Thanks Panagiotis for reporting!) * Switched the default celery pool to [solo](https://docs.celeryq.dev/en/stable/internals/reference/celery.concurrency.solo.html) in development, to fix issues running on Windows. See [updated docs](/celery). * Updated in-app help hint to recommend running `./manage.py bootstrap_ecommerce` instead of `./manage.py djstripe_sync_models price`. ### Upgrading [Section titled “Upgrading”](#upgrading-9) Htmx 2.0 requires loading new extensions. If you were loading HTMX extensions in your own templates, you will have to upgrade the location of those to the 2.0 versions. Before: ```html ``` After: ```html ``` *August 13, 2024* ## Version 2024.8 [Section titled “Version 2024.8”](#version-20248) This is a maintenance release with many small updates and fixes. ### Added [Section titled “Added”](#added-4) * **Added test cases for subscription decorators, feature gating, and views.** These can be extended/adapted to test custom subscription logic. Also added utility functions to create test products, subscriptions and mock requests. * Added a test that will fail if your project is missing any database migrations. [More on this concept here](https://adamj.eu/tech/2024/06/23/django-test-pending-migrations/). * **Added an example landing page to Tailwind builds, based largely on [Scriv’s landing page](https://scriv.ai/).** * Added `TURNSTILE_KEY` and `TURNSTILE_SECRET` to Kamal’s default secrets. * Added a section on configuring static files to the [production checklist](/deployment/production-checklist/#check-your-static-file-setup). ### Changed [Section titled “Changed”](#changed-8) * **Code is now automatically formatted for all projects.** The “Autoformat code” check box has been renamed to “Enable linting and formatting” and now only controls whether `ruff` and the pre-commit hooks are included in the project download. Projects that had already enabled auto-formatting are unaffected by this change. (See upgrade notes below.) * **The example landing pages are now used as the project’s landing page instead of being listed in the examples**. (Bulma and Tailwind builds only.) * **Team invitation emails are now better styled, matching the same format as account emails.** (Thanks EJ for the suggestion!) * The `EMAIL_BACKEND` setting is now configurable via an environment variable. Also, added a commented-out example of how to set email settings for a production email provider (Mailgun). * Apt and pip packages are now cached across Docker builds, which should result in faster build times after the first build. (Thanks Tobias for the suggestion!) * Improved the display format of “role” in the team invitation list. (thanks Andy for the suggestion!) * Change `user/` to `YOUR_GITHUB_USERNAME/` in the Digital Ocean `app-spec.yml` file to make it more obvious that it should be edited. (Thanks Stephen for suggesting!) * Changed the UI of social logins on the “sign in” page to match that of the “sign up” page on the Material Bootstrap theme. This makes the implementation more extensible and more consistent with other CSS frameworks. * **Upgraded all Python packages to the latest versions.** ### Fixed [Section titled “Fixed”](#fixed-8) * Fixed a bug where the formatting `make` targets were still calling `black` and `isort` instead of `ruff`. `make black` is now `make ruff-format` and `make isort` is now `make ruff-lint`. * Fixed a bug where the sign up view tests would fail in your environment if `settings.TURNSTILE_SECRET` was set. (Thanks Finbar for reporting!) * Fixed translations on the user profile form field names. * Removed `svg` as an option for profile picture uploads, to prevent the possibility of using it as an XSS attack vector. ([More info on this threat here](https://medium.com/@rdillon73/hacktrick-stored-xss-via-a-svg-image-3def20968d9)). * Disable debug toolbar in tests, which fixes test failures under certain conditions. * Bumped the Postgres version used by Digital Ocean deployments from 12 to 16. Digital Ocean has deprecated support for version 12. (Thanks Stephen for reporting!) * Simplified how the list of social login buttons is rendered, and make social login buttons work when configuring social applications in settings (previously buttons only showed up if you configured apps in the database). See upgrade note below. ### Removed [Section titled “Removed”](#removed-2) * Deleted the “sticky header” html and CSS code that was only used on the example landing pages. ### Upgrade Notes [Section titled “Upgrade Notes”](#upgrade-notes-1) * If you had **not** been using auto-formatting until now, you should first follow the instructions for [migrating to auto-formatted code](/cookbooks/#migrating-to-auto-formatted-code) prior to upgrading to this release. Otherwise you will likely get a lot of formatting-related merge conflicts when trying to upgrade. * If you already enabled auto-formatting (most projects), you don’t need to do anything. * If you had previously configured allauth social applications in the database *and* in your settings file, you may see a duplicate “Login with XXX” button on the sign up and login pages. To fix this, remove the social application from either your settings or the database. *August, 7, 2024* ## Version 2024.6.1 [Section titled “Version 2024.6.1”](#version-202461) This is hotfix release that addresses a few issues from yesterday’s update: * Fix app styles accidentally being purged during the Docker build process. This caused styling on Docker-based deployments for tailwind builds. (Thanks Steve for reporting!) * Moved channels url import to after Django initialization. This fixes an `AppRegistryNotReady` error when deploying asynchronous apps with the AI chat app enabled. (Thanks Roman for reporting!) * Don’t create the periodic task to sync subscriptions unless per-unit billing is enabled. *June 6, 2024* ## Version 2024.6 [Section titled “Version 2024.6”](#version-20246) This is a feature release with a few big updates and a lot of smaller ones. ### AI model changes [Section titled “AI model changes”](#ai-model-changes) The library used for non-OpenAI LLMs has been changed from [`llm`](https://github.com/simonw/llm) to [`litellm`](https://docs.litellm.ai/docs/). Reasons for this change include: * It has far fewer additional dependencies. * It supports async APIs out of the box (for most models). * The `llm` library is more targeted for the command line use-case, whereas `litellm` offers similar functionality as a native Python library with a cleaner API. Litellm can still be used with all common AI models, including OpenAI, Anthropic/Claude, and local models (via ollama). For details on getting started with `litellm` see the updated [AI documentation](/ai/llms). ### Formatting and linting now use Ruff [Section titled “Formatting and linting now use Ruff”](#formatting-and-linting-now-use-ruff) Black and isort have been replaced with [ruff](https://github.com/astral-sh/ruff)---a Python linter/formatter that offers the same functionality as those tools but is much faster. Additionally, Pegasus will now remove unused imports from your files automatically, both when building your project and if you have set up `pre-commit`. This change should be a relatively seamless drop-in replacement, though you may see some new lint errors in your projects which you can choose to address. ### Spam prevention updates [Section titled “Spam prevention updates”](#spam-prevention-updates) There has been a dramatic increase in spam-bots over the last month. Many of these bots target seemingly-innocuous functionality like sign up and password reset forms. This version includes a few updates to help combat these bots. First, you can now easily add [Cloudflare turnstile](https://www.cloudflare.com/products/turnstile/) to your sign up forms, which will present the user with a captcha and should help reduce bot sign-ups. See [the turnstile documentation](/configuration/#turnstile) for information on setting this up. Additionally, the `ACCOUNT_EMAIL_UNKNOWN_ACCOUNTS` setting has been set to `False` by default. This prevents “forgot password” and “magic link” emails from being sent out to unknown accounts. It should also help reduce unnecessary email sending. Finally, the [admin dashboard](#admin-dashboard) no longer shows users with unconfirmed email addresses if you have set `ACCOUNT_EMAIL_VERIFICATION = 'mandatory'`. This helps filter out likely bots from the report to provide clearer visibilty of people actually signing up for your app. ### Complete changelog [Section titled “Complete changelog”](#complete-changelog-1) Below is the complete set of changes in this release. #### Added [Section titled “Added”](#added-5) * **Added configurable captcha support on sign up pages, using [Cloudflare turnstile](https://www.cloudflare.com/products/turnstile/).** See [the turnstile documentation](/configuration/#turnstile) for more information on setting this up. (Thanks Troy, Jacob, Robert and others for suggesting.) * Added API views for two-factor authentication, and to change the logged-in user’s password. (Thanks Finbar for suggesting!) * Add UI to tell users they need a verified email address prior to setting up two-factor auth. * Also added a `has_verified_email` helper class to the `CustomUser` model. * Added tests for the delete team view for both team admins and members. (HTMX builds only) * Added test for team member removal permissions. * Add display and sort on the number of active members in the teams admin. #### Fixed [Section titled “Fixed”](#fixed-9) * Fixed a bug where team names longer than 50 characters could cause a crash during sign up. * Fixed a bug where multi-factor authentication QR codes had a dark background when dark mode was enabled (Tailwind builds only). (Thanks Artem for reporting!) * Fixed a bug where it was possible to bypass two-factor-authentication when using the API authentication views. (Thanks Finbar for reporting and helping with the fix!) * Fixed a bug where deleting the user’s only team while impersonating them resulted in a temporary crash. (Thanks EJ for reporting!) * Fixed a bug where creating an API key crashed if your user’s first + last name combined to more than 40 characters. (Thanks Luc for reporting!) * Improved the UI feedback when LLMs fail (e.g. if your API key is wrong or ollama is not running). * Removed the `static/css` and `static/js` directories from the `.dockerignore` file so that other project files can be included in these directories. Also updated the production Docker build process so that any existing files are overwritten by the built versions. (Thanks Raul for reporting!) * Made some performance improvements to the production Dockerfile build (don’t rebuild the front end if there are no changes in the dependent files). * Better support trialing subscriptions with no payment methods. The subscription UI will now show the date the trial ends and won’t log errors about missing invoices. (Thanks Jarrett for reporting!) #### Changed [Section titled “Changed”](#changed-9) * **Upgraded all Python packages to the latest versions.** * **Upgraded all JavaScript packages to the latest versions.** * **Non-OpenAI builds now use `litellm` instead of `llm`.** See above. (Thanks Sarthak for the suggestion!) * **Changed the formatter/linter from `black` and `isort` to [ruff](https://github.com/astral-sh/ruff).** See above. * Also addressed a handful of minor linting errors that came up as a result of this change. * Codebase linting is now substantially faster. * Unused imports are now automatically removed when building your projects. * **Celerybeat now uses the `django-celery-beat` library to store tasks in the database instead of on the filesystem.** This improves support for celerybeat on Docker-based platforms. (Thanks Peter and Artem for the suggestion!) * Also added a migration to save the default scheduled tasks in the database. * The login API response has changed, to allow for two-factor auth prompts, and more machine-readable status fields. * Removed the no-longer-used `use_json_field=True` argument from wagtail `StreamField`s. * The admin dashboard no longer shows users with unconfirmed email addresses if you have set `ACCOUNT_EMAIL_VERIFICATION = 'mandatory'`. * The admin dashboard now includes sign ups from the current date, by default. * Changed behavior when team role checks fail from raising a `TeamPermissionError` to returning a 403 response, and updated affected tests. One side effect of this is that the stack traces are removed from successful test runs. * Secret keys should no longer change every time you build your Pegasus project. They are also now clearly prefixed with `django-insecure-` to indicate that they should be changed in production. * Updated the default OpenAI chat model to gpt-4o. * Upgraded the openapi client generator to version 7.5.0 and also pinned the version used by `make build-api-client` to the same one. * Team IDs are now optional on the create team page (HTMX builds only). * Add clearer error message when charts are broken due to api config issue. (Thanks Yngve for reporting!) * Added `assume_scheme="https"` to form `URLField`s to be compatible with Django 6 behavior. * Added `FORMS_URLFIELD_ASSUME_HTTPS = True` to be compatible with Django 6 behavior. * Set `ACCOUNT_EMAIL_UNKNOWN_ACCOUNTS = False` by default, so that “forgot password” emails do not get sent to unknown accounts. This can help prevent spam bots. #### Removed [Section titled “Removed”](#removed-3) * Removed `black` and `isort` from dev-requirements, since they have been replaced by `ruff`. * Removed `llm` library and associated code, since it has been replaced by `litellm`. * Removed no longer used `TeamPermissionError` class. #### Standalone front end [Section titled “Standalone front end”](#standalone-front-end) The following changes affect the experimental [standalone front end](/experimental/react-front-end): * **The standalone React front end now supports two-factor-authentication.** * Improve the UI when you have login issues in the standalone React front end. *June 5, 2024* ## Version 2024.5.3 [Section titled “Version 2024.5.3”](#version-202453) This is a hotfix release that fixes a bug where the landing and dashboard page image was accidentally removed if you built without the examples enabled. *May 21, 2024* ## Version 2024.5.2 [Section titled “Version 2024.5.2”](#version-202452) This is a hotfix release that fixes a bug that prevented the team management page from loading in certain browsers if you built with a React front end and with translations enabled. Thanks Finbar for reporting! * Added `defer` keyword to various bundle scripts so they are loaded after the JavaScript translation catalog. * Updated references to `SiteJS` to run on the `DOMContentLoaded` event to allow for usage of the `defer` tag. *May 16, 2024* ## Version 2024.5.1 [Section titled “Version 2024.5.1”](#version-202451) This is a hotfix release that fixes issues running the [experimental React frontend](/experimental/react-front-end) in Docker. Thanks Mohamed for reporting this! * Fix `api-client` path in the frontend docker container and add to `optimizeDeps` in vite config. * Mount `node_modules` as an anonymous volume in the frontend docker container, so it is not overwritten. * Automatically create `./frontend/.env` when running `make init` if it doesn’t exist. *May 14, 2024* ## Version 2024.5 [Section titled “Version 2024.5”](#version-20245) This is a major release with several big updates. Here are a few highlights: ### New AI models [Section titled “New AI models”](#new-ai-models) In addition to using OpenAI chat models, you can now build the Pegasus AI chat applicaiton with the [`llm` library](https://github.com/simonw/llm). This lets you run the chat application against any supported model---including the Anthropic family (Claude 3), and local models like Llama 3. Additionally, the image generation demo now supports Dall-E-3 and Stable Diffusion 3. For complete details, see the new [AI documentation](/ai/images). ### Health Checks [Section titled “Health Checks”](#health-checks) A new setting allows you to turn on health checks for your application, powered by [django-health-check](https://django-health-check.readthedocs.io/en/latest/). This will create an endpoint (at `/health` by default) that pings your database, Redis instance, and Celery workers and returns a non-200 response code if there are any identified issues. These endpoints can be connected to a monitoring tool like [StatusCake](https://www.statuscake.com/) or [Uptime Robot](https://uptimerobot.com/) so that you can be alerted whenever your site is having issues. See the section on [monitoring](/deployment/production-checklist/#set-up-monitoring) in the production checklist for more information. ### Allauth updates [Section titled “Allauth updates”](#allauth-updates) The [django-allauth](https://docs.allauth.org/en/latest/) library was updated to the latest version, which enabled several useful changes. The first is a “sign in by email code” option which can be used in addition to the standard username/password and social option. Users can request a code be sent to their registered email and can then use that to login. See [the magic code documentation](/configuration/#enabling-sign-in-by-email-code) to enable/disable this. The second is using the recent [multi-factor authentication](https://docs.allauth.org/en/latest/mfa/index.html) support added to allauth in favor of the third-party `django-allauth-2fa` library. This reduces dependencies and puts all of authentication functionality on a standard path moving forwards. The complete release notes are below: ### Added [Section titled “Added”](#added-6) * **Added an optional health check endpoint at /health/.** (see above for details) * **Added an option to connect the chatbot to other LLMs**. (see above for details) * **The AI image generation now supports Dall-E 3 and Stability AI.** * **All generated projects now include a `LICENSE.md` file.** The goal of the license file is not to change how Pegasus can be used in any way, but rather to document those terms in the codebase itself (previously they were only documented on the [terms page](https://www.saaspegasus.com/terms/)). For more information you can see the new [license page](https://www.saaspegasus.com/license/). * **Added support for “magic-code login”, where a user can login to the site by requesting a code to their email address.** [Documentation.](/configuration/#enabling-sign-in-by-email-code) * **Google cloud run builds now support Redis.** For details, see the [updated documentation](/deployment/google-cloud). (Thanks Forrest for suggesting!) * Added a `custom.mk` file where you can add additional `make` targets without worrying about future Pegasus upgrades. (Thanks John for proposing this!) ### Changed [Section titled “Changed”](#changed-10) * Upgraded allauth to the latest version (0.62.1). * **Migrated two-factor authentication from the third-party `django-allauth-2fa` to the `django-allauth` built-in implementation.** See upgrade notes below for migrating existing projects. * Refactored how many allauth views work to be compatible with their new template override system. * **Bootstrap and Bulma builds: Move sidebar navigation into the mobile menu instead of having it take up the top of the screen on mobile screens**, similar to how things already worked on Tailwind and Material. (Thanks Luc for the nudge!) * This includes splitting out the menu items into their own sub-template files so they can be included in both menus. * Inline buttons are now spaced using the `gap` CSS property instead of the `pg-ml` class on individual buttons. * `Alpine.start()` is now called on `DOMContentLoaded` loaded event instead of using `window.load`. This makes Alpine-powered UIs more responsive, especially when used on pages with lots of images. * **Updated external JavaScript imports to use [the `defer` keyword](https://www.w3schools.com/tags/att_script_defer.asp) for slightly better page load performance.** (See upgrade note.) * Also updated inline JavaScript code in a handful of places to be compatible with deferred scripts. * Added a Github logo to connected Github accounts on profile page. * **The AI image demo and code has been moved to a first-class Pegasus application / tab.** * Update the docker container registry used by Google Cloud to reflect the latest version in Google. Also push more Google Cloud configuration variables out of the Makefile and into the environment variables. (Thanks Erwin for reporting!) * Added additional `.env` files to `.dockerignore` for Google Cloud builds. * Bumped django to the latest `5.0.6` release. ### Fixed [Section titled “Fixed”](#fixed-10) * **SQLite build now properly parse `DATABASE_URL` if it is set. This fixes issues deploying to certain platforms when building with SQLite.** (Thanks Manasvini for reporting!) * Updated allauth documentation links in the README to point to the new [allauth docs site](https://docs.allauth.org/). (Thanks Shantu for reporting!) ### Removed [Section titled “Removed”](#removed-4) * Removed several no-longer-needed allauth template files. * Removed deprecated “version” field from the dev `docker-compose.yml` file. (Thanks Moyi for reporting!) * Removed no-longer-used `pg-ml` css spacing class. * Removed redundant type=“text/javascript” declarations from a few ` {% endblock %} ``` This example will open the modal with ID `onLoadModal` on page load. Alternatively, you can add individual bootstrap javascript modules via `site-bootstrap.js` like this: ```javascript require('./styles/site-bootstrap.scss'); //