Compare commits
2 Commits
bugfix/par
...
main
Author | SHA1 | Date |
---|---|---|
pedro | a67fda6b51 | |
pedro | 79a34c9b55 |
|
@ -1,5 +1,6 @@
|
||||||
DOMAIN=localhost
|
DOMAIN=localhost
|
||||||
# note that DEBUG=true make snapshot parsing more verbose
|
# note that with DEBUG=true, logs are more verbose (include tracebacks)
|
||||||
|
DEBUG=true
|
||||||
DEMO=true
|
DEMO=true
|
||||||
|
|
||||||
STATIC_ROOT=/tmp/static/
|
STATIC_ROOT=/tmp/static/
|
||||||
|
|
|
@ -34,8 +34,6 @@ DEBUG = config('DEBUG', default=False, cast=bool)
|
||||||
|
|
||||||
DOMAIN = config("DOMAIN")
|
DOMAIN = config("DOMAIN")
|
||||||
assert DOMAIN not in [None, ''], "DOMAIN var is MANDATORY"
|
assert DOMAIN not in [None, ''], "DOMAIN var is MANDATORY"
|
||||||
# this var is very important, we print it
|
|
||||||
print("DOMAIN: " + DOMAIN)
|
|
||||||
|
|
||||||
ALLOWED_HOSTS = config('ALLOWED_HOSTS', default=DOMAIN, cast=Csv())
|
ALLOWED_HOSTS = config('ALLOWED_HOSTS', default=DOMAIN, cast=Csv())
|
||||||
assert DOMAIN in ALLOWED_HOSTS, f"DOMAIN {DOMAIN} is not in ALLOWED_HOSTS {ALLOWED_HOSTS}"
|
assert DOMAIN in ALLOWED_HOSTS, f"DOMAIN {DOMAIN} is not in ALLOWED_HOSTS {ALLOWED_HOSTS}"
|
||||||
|
|
|
@ -18,6 +18,8 @@ deploy() {
|
||||||
|
|
||||||
if [ "${DEBUG:-}" = 'true' ]; then
|
if [ "${DEBUG:-}" = 'true' ]; then
|
||||||
./manage.py print_settings
|
./manage.py print_settings
|
||||||
|
else
|
||||||
|
echo "DOMAIN: ${DOMAIN}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# detect if existing deployment (TODO only works with sqlite)
|
# detect if existing deployment (TODO only works with sqlite)
|
||||||
|
|
|
@ -58,8 +58,6 @@ class Command(BaseCommand):
|
||||||
self.devices.append(Build(s, self.user))
|
self.devices.append(Build(s, self.user))
|
||||||
move_json(p, self.user.institution.name)
|
move_json(p, self.user.institution.name)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
if settings.DEBUG:
|
|
||||||
logger.exception("%s", err)
|
|
||||||
snapshot_id = s.get("uuid", "")
|
snapshot_id = s.get("uuid", "")
|
||||||
txt = "It is not possible to parse snapshot: %s"
|
txt = "Could not parse snapshot: %s"
|
||||||
logger.error(txt, snapshot_id)
|
logger.error(txt, snapshot_id)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import logging
|
import logging
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
# Colors
|
# Colors
|
||||||
RED = "\033[91m"
|
RED = "\033[91m"
|
||||||
|
@ -24,6 +25,11 @@ class CustomFormatter(logging.Formatter):
|
||||||
record.msg = self.highlight_args(record.msg, record.args, color)
|
record.msg = self.highlight_args(record.msg, record.args, color)
|
||||||
record.args = ()
|
record.args = ()
|
||||||
|
|
||||||
|
# provide trace when DEBUG config
|
||||||
|
if settings.DEBUG:
|
||||||
|
import traceback
|
||||||
|
print(traceback.format_exc())
|
||||||
|
|
||||||
return super().format(record)
|
return super().format(record)
|
||||||
|
|
||||||
def highlight_args(self, message, args, color):
|
def highlight_args(self, message, args, color):
|
||||||
|
|
Loading…
Reference in New Issue