Skip to content

Commit d856614

Browse files
humitosstsewd
andauthored
Do not run djstripe checks on builders (#12159)
We found this while performing the deploy. Builders do not have access to the database, and `djstripe` runs some checks that access the database to know if there are API keys defined there. References: * https://github.com/dj-stripe/dj-stripe/blob/main/djstripe/checks.py#L126 * https://github.com/django/django/blob/main/django/core/checks/registry.py#L85 * https://docs.djangoproject.com/en/5.2/topics/checks/ --------- Co-authored-by: Santos Gallegos <[email protected]>
1 parent 5382b3e commit d856614

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

readthedocs/projects/apps.py

+14
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
"""Project app config."""
22

3+
import socket
4+
35
from django.apps import AppConfig
6+
from django.conf import settings
7+
from django.core.checks.registry import registry
48

59

610
class ProjectsConfig(AppConfig):
@@ -13,3 +17,13 @@ def ready(self):
1317
import readthedocs.projects.tasks.builds # noqa
1418
import readthedocs.projects.tasks.search # noqa
1519
import readthedocs.projects.tasks.utils # noqa
20+
21+
# HACK: remove djstripe initial checks.
22+
# It performs checks that require access to the database, which make the builders to fail.
23+
# Note this is placed in the `projects` app, since it's listed after `djstripe` in `INSTALLED_APPS`, as this code has to be executed _after_ djstripe has been initialized.
24+
#
25+
# https://github.com/dj-stripe/dj-stripe/blob/8e536409b815b2a393ef1ba8eac3d27bd69a5664/djstripe/checks.py#L20
26+
if settings.DEBUG or socket.gethostname().startswith("build-"):
27+
registry.registered_checks = {
28+
item for item in registry.registered_checks if "djstripe" not in item.tags
29+
}

0 commit comments

Comments
 (0)