mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Improve cli experience (#4881)
* fix cli call to get a fully running invoke * use relativ import This is importend when imported from outside * Add version command * Add more information to version command * make print easier to understand
This commit is contained in:
parent
4079224658
commit
fdd4169cd7
@ -9,7 +9,7 @@ import subprocess
|
|||||||
|
|
||||||
import django
|
import django
|
||||||
|
|
||||||
from InvenTree.api_version import INVENTREE_API_VERSION
|
from .api_version import INVENTREE_API_VERSION
|
||||||
|
|
||||||
# InvenTree software version
|
# InvenTree software version
|
||||||
INVENTREE_SW_VERSION = "0.12.0 dev"
|
INVENTREE_SW_VERSION = "0.12.0 dev"
|
||||||
|
2
Procfile
2
Procfile
@ -1,3 +1,3 @@
|
|||||||
web: env/bin/gunicorn --chdir $APP_HOME/InvenTree -c InvenTree/gunicorn.conf.py InvenTree.wsgi -b 0.0.0.0:$PORT
|
web: env/bin/gunicorn --chdir $APP_HOME/InvenTree -c InvenTree/gunicorn.conf.py InvenTree.wsgi -b 0.0.0.0:$PORT
|
||||||
worker: env/bin/python InvenTree/manage.py qcluster
|
worker: env/bin/python InvenTree/manage.py qcluster
|
||||||
cli: env/bin/python -m invoke
|
cli: . env/bin/activate && exec env/bin/python -m invoke
|
||||||
|
34
tasks.py
34
tasks.py
@ -7,6 +7,7 @@ import re
|
|||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from platform import python_version
|
||||||
|
|
||||||
from invoke import task
|
from invoke import task
|
||||||
|
|
||||||
@ -641,3 +642,36 @@ def schema(c, filename='schema.yml', overwrite=False):
|
|||||||
"""Export current API schema."""
|
"""Export current API schema."""
|
||||||
check_file_existance(filename, overwrite)
|
check_file_existance(filename, overwrite)
|
||||||
manage(c, f'spectacular --file {filename}')
|
manage(c, f'spectacular --file {filename}')
|
||||||
|
|
||||||
|
|
||||||
|
@task(default=True)
|
||||||
|
def version(c):
|
||||||
|
"""Show the current version of InvenTree."""
|
||||||
|
import InvenTree.InvenTree.version as InvenTreeVersion
|
||||||
|
from InvenTree.InvenTree.config import (get_config_file, get_media_dir,
|
||||||
|
get_static_dir)
|
||||||
|
|
||||||
|
print(f"""
|
||||||
|
InvenTree - inventree.org
|
||||||
|
The Open-Source Inventory Management System\n
|
||||||
|
|
||||||
|
Installation paths:
|
||||||
|
Base {localDir()}
|
||||||
|
Config {get_config_file()}
|
||||||
|
Media {get_media_dir()}
|
||||||
|
Static {get_static_dir()}
|
||||||
|
|
||||||
|
Versions:
|
||||||
|
Python {python_version()}
|
||||||
|
Django {InvenTreeVersion.inventreeDjangoVersion()}
|
||||||
|
InvenTree {InvenTreeVersion.inventreeVersion()}
|
||||||
|
API {InvenTreeVersion.inventreeApiVersion()}
|
||||||
|
|
||||||
|
Commit hash:{InvenTreeVersion.inventreeCommitHash()}
|
||||||
|
Commit date:{InvenTreeVersion.inventreeCommitDate()}""")
|
||||||
|
if len(sys.argv) == 1 and sys.argv[0].startswith('/opt/inventree/env/lib/python'):
|
||||||
|
print("""
|
||||||
|
You are probably running the package installer / single-line installer. Please mentioned that in any bug reports!
|
||||||
|
|
||||||
|
Use '--list' for a list of available commands
|
||||||
|
Use '--help' for help on a specific command""")
|
||||||
|
Loading…
Reference in New Issue
Block a user