Skip to content

Commit abd1ca7

Browse files
committed
Do not run djstripe checks on builders
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.
1 parent 8d98876 commit abd1ca7

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 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)