Add more targets

- superuser
- backup
This commit is contained in:
Oliver Walters 2020-08-21 21:24:02 +10:00
parent f5fd0fc5be
commit 592e87941d
2 changed files with 20 additions and 25 deletions

View File

@ -1,25 +0,0 @@
clean:
find . -path '*/__pycache__/*' -delete
find . -type d -name '__pycache__' -empty -delete
find . -name *.pyc -o -name *.pyo -delete
rm -rf *.egg-info
rm -rf .cache
rm -rf .tox
rm -f .coverage
# Create a superuser account
superuser:
cd InvenTree && python3 manage.py createsuperuser
# Install packages required to generate code docs
docreqs:
pip3 install -U -r docs/requirements.txt
# Build code docs
docs:
cd docs && make html
# Make database backup
backup:
cd InvenTree && python3 manage.py dbbackup
cd InvenTree && python3 manage.py mediabackup

View File

@ -100,6 +100,14 @@ def install(c):
print("Config file 'config.yaml' does not exist - copying from template.")
copyfile(CONFIG_TEMPLATE_FILE, CONFIG_FILE)
@task
def superuser(c):
"""
Create a superuser (admin) account for the database.
"""
manage(c, 'createsuperuser')
@task
def migrate(c):
"""
@ -222,3 +230,15 @@ def postgresql(c):
c.run('sudo apt-get install postgresql postgresql-contrib libpq-dev')
c.run('pip3 install psycopg2')
@task
def backup(c):
"""
Create a backup of database models and uploaded media files.
Backup files will be written to the 'backup_dir' file specified in 'config.yaml'
"""
manage(c, 'dbbackup')
manage(c, 'mediabackup')