6.5.1. Maintenance / Rebuilding¶
Several commands support ongoing maintenance of the App Framework server, useful during development, debugging, or upgrading.
6.5.1.1. Collecting Reports¶
When a new App Framework project gets created, all the available example and default reports are copied to the reports directory. These reports can be updated, or deleted freely, and can be restored using the collectreports command:
$ python manage.py collectreports --help
Usage: manage.py collectreports [options] None
Collects reports into App Framework project.
Options:
-v VERBOSITY, --verbosity=VERBOSITY
Verbosity level; 0=minimal output, 1=normal output,
2=verbose output, 3=very verbose output
--settings=SETTINGS The Python path to a settings module, e.g.
"myproject.settings.main". If this isn't provided, the
DJANGO_SETTINGS_MODULE environment variable will be
used.
--pythonpath=PYTHONPATH
A directory to add to the Python path, e.g.
"/home/djangoprojects/myproject".
--traceback Print traceback on exception
--overwrite Overwrite ALL existing reports.
--version show program's version number and exit
-h, --help show this help message and exit
When adding a new package, or plugin to the system, this command should be run to copy over any new example reports included.
Use the overwrite option carefully, this will overwrite any changes you have made to the reports in your folder.
6.5.1.2. Reloading Reports¶
With any new changes made to the reports in your reports directory you will want to get those changes recognized by the system. The most useful way is to use the Reload This Report or Reload All Reports from the upper-right dropdown menu in the browser, but there is also a command-line option available too:
$ python manage.py reload --help
Usage: manage.py reload [options] None
Reloads the configuration defined in the config directory
Options:
-v VERBOSITY, --verbosity=VERBOSITY
Verbosity level; 0=minimal output, 1=normal output,
2=verbose output, 3=very verbose output
--settings=SETTINGS The Python path to a settings module, e.g.
"myproject.settings.main". If this isn't provided, the
DJANGO_SETTINGS_MODULE environment variable will be
used.
--pythonpath=PYTHONPATH
A directory to add to the Python path, e.g.
"/home/djangoprojects/myproject".
--traceback Print traceback on exception
--report-id=REPORT_ID
Reload single report.
--report-name=REPORT_NAME
Reload single report by fully qualified name.
--report-dir=REPORT_DIR
Reload reports from this directory.
--namespace=NAMESPACE
Reload reports under this namespace.
--version show program's version number and exit
-h, --help show this help message and exit
6.5.1.3. Collecting Logs¶
In cases where a problem occurs, the logfiles usually provide a good indicator of the root cause. A built-in command helps collect these files for distribution to the developers or for posting to mailing lists or archiving:
$ python manage.py collect_logs --help
Usage: manage.py collect_logs [options] None
Collects log files and system info and creates file `debug-<timestamp>.zip`
Options:
<truncated>
6.5.1.4. Resetting App Framework Database¶
When wishing to start from a clean slate, the command reset_appfwk can be used to clear the database, caches, and logs then re-initialize everything.
A helpful warning will be presented (unless skipped with the --force option) as a reminder that this will completely delete the database! Though the warning is dire, there are only a few items which will be irretrieveably lost, and there are workarounds for users and devices:
- users
- devices
- locations
- admin preferences
- caches, including job history
For users, by default the server will attempt to store the user table offline before resetting the database, and then restore it afterwards. This can be skipped via the --drop-users option which will result in all users being deleted with only the default admin user remaining.
For devices, each time a new device gets added or updated during normal system use, a local cache gets created with all the info minus the password, so the primary inconvenience here requires all passwords to be re-entered after a reset.
Reports and their defined tables will be re-created as part of the reload process.
$ python manage.py reset_appfwk --help
Usage: manage.py reset_appfwk [options] None
Reset the database. Prompts for confirmation unless `--force` is included as an argument.
Options:
-v VERBOSITY, --verbosity=VERBOSITY
Verbosity level; 0=minimal output, 1=normal output,
2=verbose output, 3=very verbose output
--settings=SETTINGS The Python path to a settings module, e.g.
"myproject.settings.main". If this isn't provided, the
DJANGO_SETTINGS_MODULE environment variable will be
used.
--pythonpath=PYTHONPATH
A directory to add to the Python path, e.g.
"/home/djangoprojects/myproject".
--traceback Print traceback on exception
--force Ignore reset confirmation.
--drop-users Drop all locally created users, only default admin
account will be enabled afterwards. Default will keep
all user accounts across reset.
--version show program's version number and exit
-h, --help show this help message and exit