mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Fix import error
This commit is contained in:
parent
24823adc6d
commit
c1aed51de1
@ -45,6 +45,8 @@ def get_setting(environment_var, backup_val, default_value=None):
|
|||||||
|
|
||||||
return default_value
|
return default_value
|
||||||
|
|
||||||
|
# Determine if we are running in "test" mode e.g. "manage.py test"
|
||||||
|
TESTING = 'test' in sys.argv
|
||||||
|
|
||||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
@ -336,7 +338,7 @@ DATABASES = {}
|
|||||||
When running unit tests, enforce usage of sqlite3 database,
|
When running unit tests, enforce usage of sqlite3 database,
|
||||||
so that the tests can be run in RAM without any setup requirements
|
so that the tests can be run in RAM without any setup requirements
|
||||||
"""
|
"""
|
||||||
if 'test' in sys.argv:
|
if TESTING:
|
||||||
logger.info('InvenTree: Running tests - Using sqlite3 memory database')
|
logger.info('InvenTree: Running tests - Using sqlite3 memory database')
|
||||||
DATABASES['default'] = {
|
DATABASES['default'] = {
|
||||||
# Ensure sqlite3 backend is being used
|
# Ensure sqlite3 backend is being used
|
||||||
@ -479,6 +481,9 @@ USE_I18N = True
|
|||||||
|
|
||||||
USE_L10N = True
|
USE_L10N = True
|
||||||
|
|
||||||
|
# Do not use native timezone support in "test" mode
|
||||||
|
# It generates a *lot* of cruft in the logs
|
||||||
|
if not TESTING:
|
||||||
USE_TZ = True
|
USE_TZ = True
|
||||||
|
|
||||||
DATE_INPUT_FORMATS = [
|
DATE_INPUT_FORMATS = [
|
||||||
|
@ -75,6 +75,12 @@ def delete_successful_tasks():
|
|||||||
which are more than a month old.
|
which are more than a month old.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
try:
|
||||||
|
from django_q.models import Success
|
||||||
|
logger.warning("Could not perform 'delete_successful_tasks' - App registry not ready")
|
||||||
|
except AppRegistryNotReady:
|
||||||
|
return
|
||||||
|
|
||||||
threshold = datetime.now() - timedelta(days=30)
|
threshold = datetime.now() - timedelta(days=30)
|
||||||
|
|
||||||
results = Success.objects.filter(
|
results = Success.objects.filter(
|
||||||
|
Loading…
Reference in New Issue
Block a user