mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-19 05:25:42 +00:00
Docker fix (#8835)
* Fix server command in Dockerfile * Ensure invoke is installed into the venv * Run extra check in docker build step * Improve documentation * Intercept ModuleNotFoundError - Clear error message * Docs updates * Add extra check to dev docker build * Cleanup tasks.py * Prevent double activation of venv * Change order of operations --------- Co-authored-by: Matthias Mair <code@mjmair.com>
This commit is contained in:
23
tasks.py
23
tasks.py
@ -15,6 +15,29 @@ from invoke import Collection, task
|
||||
from invoke.exceptions import UnexpectedExit
|
||||
|
||||
|
||||
def task_exception_handler(t, v, tb):
|
||||
"""Handle exceptions raised by tasks.
|
||||
|
||||
The intent here is to provide more 'useful' error messages when tasks fail.
|
||||
"""
|
||||
sys.__excepthook__(t, v, tb)
|
||||
|
||||
if t is ModuleNotFoundError:
|
||||
mod_name = str(v).split(' ')[-1].strip("'")
|
||||
|
||||
error(f'Error importing required module: {mod_name}')
|
||||
warning('- Ensure the correct Python virtual environment is active')
|
||||
warning(
|
||||
'- Ensure that the invoke tool is installed in the active Python environment'
|
||||
)
|
||||
warning(
|
||||
"- Ensure all required packages are installed by running 'invoke install'"
|
||||
)
|
||||
|
||||
|
||||
sys.excepthook = task_exception_handler
|
||||
|
||||
|
||||
def success(*args):
|
||||
"""Print a success message to the console."""
|
||||
msg = ' '.join(map(str, args))
|
||||
|
Reference in New Issue
Block a user