-
-
Notifications
You must be signed in to change notification settings - Fork 277
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2160 from Sefaria/gunicorn-startup-script
fix(helm): move library init code to gunicorn start hook.
- Loading branch information
Showing
6 changed files
with
25 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Using staticfiles as the base class in order to not overwrite its custom runserver logic | ||
from django.contrib.staticfiles.management.commands.runserver import Command as RunserverCommand | ||
from reader.startup import init_library_cache | ||
import structlog | ||
logger = structlog.get_logger(__name__) | ||
|
||
|
||
class Command(RunserverCommand): | ||
|
||
def get_handler(self, *args, **options): | ||
handler = super(Command, self).get_handler(*args, **options) | ||
logger.info("Starting reader application") | ||
init_library_cache() | ||
return handler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
|
||
|
||
def init_library_cache(): | ||
import django | ||
django.setup() | ||
import structlog | ||
logger = structlog.get_logger(__name__) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters