From 5ee07eae7c6a7cb9a83ac35a5751c2e799f1b56f Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 1 Aug 2019 20:07:06 +1000 Subject: [PATCH] Update installation routine and docs - Single call of "make install" does everything - Add backup_dir option to yaml config file --- InvenTree/InvenTree/settings.py | 4 +++- InvenTree/config.yaml | 6 +++++- Makefile | 6 +++++- docs/config.rst | 7 ++++++- docs/start.rst | 13 +++++++------ 5 files changed, 26 insertions(+), 10 deletions(-) diff --git a/InvenTree/InvenTree/settings.py b/InvenTree/InvenTree/settings.py index 42d9a4b243..cd55fc1b25 100644 --- a/InvenTree/InvenTree/settings.py +++ b/InvenTree/InvenTree/settings.py @@ -231,4 +231,6 @@ IMPORT_EXPORT_USE_TRANSACTIONS = True # Settings for dbbsettings app DBBACKUP_STORAGE = 'django.core.files.storage.FileSystemStorage' -DBBACKUP_STORAGE_OPTIONS = {'location': tempfile.gettempdir()} +DBBACKUP_STORAGE_OPTIONS = { + 'location': CONFIG.get('backup_dir', tempfile.gettempdir()), +} diff --git a/InvenTree/config.yaml b/InvenTree/config.yaml index 5aa24a3e69..510951842a 100644 --- a/InvenTree/config.yaml +++ b/InvenTree/config.yaml @@ -43,4 +43,8 @@ media_root: './media' static_root: './static' # Logging options -log_queries: False \ No newline at end of file +log_queries: False + +# Backup options +# Set the backup_dir parameter to store backup files in a specific location +# backup_dir = "/home/me/inventree-backup/" \ No newline at end of file diff --git a/Makefile b/Makefile index cdef6b87c4..85acd5850c 100644 --- a/Makefile +++ b/Makefile @@ -16,13 +16,17 @@ migrate: python3 InvenTree/manage.py migrate --run-syncdb python3 InvenTree/manage.py check -install: +requirements: pip3 install -U -r requirements.txt + +secret: python3 InvenTree/keygen.py superuser: python3 InvenTree/manage.py createsuperuser +install: requirements secret migrate superuser + style: flake8 InvenTree diff --git a/docs/config.rst b/docs/config.rst index d8388ae155..fc768b8e87 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -47,4 +47,9 @@ For further information, refer to the following documentation: Uploaded File Storage --------------------- -By default, uploaded files are stored in the local direction ``./media``. This directory should be changed based on the particular installation requirements. \ No newline at end of file +By default, uploaded files are stored in the local direction ``./media``. This directory should be changed based on the particular installation requirements. + +Backup Location +--------------- + +The default behaviour of the database backup is to generate backup files for database tables and media files to the user's temporary directory. The target directory can be overridden by setting the *backup_dir* parameter in the config file. \ No newline at end of file diff --git a/docs/start.rst b/docs/start.rst index 829d051736..9fe52868aa 100644 --- a/docs/start.rst +++ b/docs/start.rst @@ -24,6 +24,8 @@ which performs the following actions: * Installs all required Python packages using pip package manager * Generates a SECREY_KEY file required for the django authentication framework +* Performs initial database installation and migrations +* Prompts user to create a superuser account Install Configuration --------------------- @@ -34,15 +36,10 @@ The configuration file provides administrators control over various setup option For further information on installation configuration, refer to the `Configuration `_ section. -Superuser Account ------------------ - -Run ``make superuser`` to create a superuser account, required for initial system login. - Run Development Server ---------------------- -Run ``python3 InvenTree/manage.py runserver`` to launch a development server. This will launch the InvenTree web interface at ``127.0.0.1:8000``. For other options refer to the `django docs `_. +Run ``python3 InvenTree/manage.py runserver 127.0.0.1:8000`` to launch a development server. This will launch the InvenTree web interface at ``127.0.0.1:8000``. For other options refer to the `django docs `_. Database Migrations ------------------- @@ -54,6 +51,10 @@ Development and Testing Other shorthand functions are provided for the development and testing process: +* ``make requirements`` - Install all required underlying packages using PIP +* ``make secret`` - Generate the SECRET_KEY file for session validation +* ``make superuser`` - Create a superuser account +* ``make backup`` - Backup database tables and media files * ``make test`` - Run all unit tests * ``make coverage`` - Run all unit tests and generate code coverage report * ``make style`` - Check Python codebase against PEP coding standards (using Flake)