mirror of
https://github.com/inventree/InvenTree.git
synced 2026-01-29 01:23:37 +00:00
feat(backend): better for logging to detect issues with static files discovery (#11067)
* reduce noise in docker * refactor path infos * add more info during local frontend build * add frontend info during release build * ignore "special" import * change var name
This commit is contained in:
@@ -12,6 +12,8 @@ import sys
|
||||
from datetime import datetime as dt
|
||||
from datetime import timedelta as td
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
from .api_version import INVENTREE_API_TEXT, INVENTREE_API_VERSION
|
||||
|
||||
# InvenTree software version
|
||||
@@ -22,6 +24,7 @@ MIN_PYTHON_VERSION = (3, 11)
|
||||
|
||||
logger = logging.getLogger('inventree')
|
||||
|
||||
git_warning_txt = 'INVE-W3: Could not detect git information.'
|
||||
|
||||
# Discover git
|
||||
try:
|
||||
@@ -33,8 +36,11 @@ try:
|
||||
main_repo = Repo(pathlib.Path(__file__).parent.parent.parent.parent.parent)
|
||||
main_commit = main_repo[main_repo.head()]
|
||||
except NotGitRepository:
|
||||
# If we are running in a docker container, the repo may not be available
|
||||
logger.warning('INVE-W3: Could not detect git information.')
|
||||
# If we are running in a docker container, the repo may not be available, only logging as warning if not in docker
|
||||
if settings.DOCKER:
|
||||
logger.info(git_warning_txt)
|
||||
else:
|
||||
logger.warning(git_warning_txt)
|
||||
main_repo = None
|
||||
main_commit = None
|
||||
|
||||
@@ -51,7 +57,7 @@ except ImportError:
|
||||
main_commit = None
|
||||
main_branch = None
|
||||
except Exception as exc:
|
||||
logger.warning('INVE-W3: Could not detect git information.', exc_info=exc)
|
||||
logger.warning(git_warning_txt, exc_info=exc)
|
||||
main_repo = None
|
||||
main_commit = None
|
||||
main_branch = None
|
||||
|
||||
Reference in New Issue
Block a user