Forge Pro
Forge Pro is a set of private packages aimed at more advanced Django development, or solving issues that come with real-world usage of your app.
You can install them individually,
or all at once with the forge-pro
dependency.
Authentication
The Forge Pro packages are installed from pypi.forgepackages.com
,
which is a private package repository.
You can subscribe and get your credentials at billing.forgepackages.com.
Below is an example of how to use those credentials with Poetry,
but you can use a similar process for other pip
tools by using https://pypi.forgepackages.com/
as an extra index with the built-in authentication methods.
Add the following source to your pyproject.toml
:
[[tool.poetry.source]]
name = "forgepackages"
url = "https://pypi.forgepackages.com/"
Development
In development, your username will be your personal username from billing.forgepackages.com.
This way you can authenticate your entire machine for you personally:
poetry config http-basic.forgepackages <personal_username> <personal_token>
GitHub Actions
To enable access in GitHub Actions, set your project name and token as secrets on your repo. Then use the Poetry env variables to authenticate:
# .github/workflows/test.yml
# (previous steps)
- name: Install dependencies
env:
POETRY_HTTP_BASIC_FORGEPACKAGES_USERNAME: ${{ secrets.FORGEPACKAGES_PROJECT }}
POETRY_HTTP_BASIC_FORGEPACKAGES_PASSWORD: ${{ secrets.FORGEPACKAGES_TOKEN }}
run: poetry install
Heroku
For Heroku, use the same project name and token as the FORGEPACKAGES_AUTH
environment variable:
heroku config:set FORGEPACKAGES_AUTH="<project_name>:<project_token>"
Installing packages
Now you can install forge-pro
(or any individual package) using the standard commands:
poetry add forge-pro
The standard Forge Pro apps can be added with the FORGEPRO_APPS
and FORGEPRO_MIDDLEWARE
shortcuts:
# settings.py
from forgedefault_settings import FORGEPRO_APPS, FORGEPRO_MIDDLEWARE
INSTALLED_APPS = INSTALLED_APPS + FORGEPRO_APPS
MIDDLEWARE = MIDDLEWARE + FORGEPRO_MIDDLEWARE
Some apps also require URLs to be added:
# urls.py
urlpatterns = [
# ...
path("impersonate/", include("forgeimpersonate.urls")),
]
Or template tags in your base template:
<!-- base.template.html -->
{% load sentry googleanalytics stafftoolbar %}
<!doctype html>
<html lang="en">
<head>
...
{% sentry_js %}
{% googleanalytics_js %}
</head>
<body>
{% stafftoolbar %}
...
</body>
</html>
Packages like forge-sentry or forge-stripe will require API keys to work. Check the documentation for the package to see if it requires anything specific, though we strive to have good defaults for anything we can.