diff --git a/docs/start/deploy.md b/docs/start/deploy.md index c0e6677..173cc17 100644 --- a/docs/start/deploy.md +++ b/docs/start/deploy.md @@ -32,6 +32,9 @@ To enable access to the InvenTree server from other computers on a local network invoke server -a 192.168.120.1:8000 ``` +!!! warning "Not For Production" + It should be noted that the *development server* provided with django / InvenTree is probably not suitable for your production environment. Instead, use a proper web-server (such as Gunicorn, below). + ## Gunicorn Following is a simple tutorial on serving InvenTree using [Gunicorn](https://gunicorn.org/). Gunicorn is a Python WSGI server which provides a multi-worker server which is well suited to handling multiple simultaneous requests. Gunicorn is a solid choice for a production server which is easy to configure and performs well in a multi-user environment. @@ -44,6 +47,9 @@ Gunicorn can be installed using PIP: pip3 install gunicorn ``` +!!! warning "Python Environment" + Ensure that gunicorn is installed within the same python environment context as the InvenTree install - otherwise gunicorn will not be able to import the correct python modules. + ### Configure Static Directories Directories for storing *media* files and *static* files should be specified in the ``config.yaml`` configuration file. These directories are the ``MEDIA_ROOT`` and ``STATIC_ROOT`` paths required by the Django app. Ensure that both of these directories are correctly configured for your setup. diff --git a/docs/start/migrate.md b/docs/start/migrate.md index 6376362..8ff3d0d 100644 --- a/docs/start/migrate.md +++ b/docs/start/migrate.md @@ -6,16 +6,26 @@ title: Migrating Data In the case that data needs to be migrated from one database installation to another, the following procedure can be used to export data, initialize the new database, and re-import the data. +For example, if you wish to migrate from an SQLite database backend to a MySQL database backend, you will need to export the data into a standardized format, and then read it back in to the new database. + !!! warning "Backup Database" Ensure that the original database is securely backed up first! +!!! info "Up to Date" + Ensure that the original database is up to date, by running `invoke migrate` + ### Export Data +Export the database contents to a JSON file using the following command: + ``` -python3 InvenTree/manage.py dumpdata --exclude contenttypes --exclude auth.permission --indent 2 > data.json +invoke export-records -f data.json ``` -This will export all data (including user information) to a json data file. +This will create JSON file at the specified location which contains all database records. + +!!! info "Specifying filename" + The filename of the exported file can be specified using the `-f` option ### Initialize New Database @@ -27,13 +37,18 @@ Then, ensure that the database schema are correctly initialized in the new datab invoke migrate ``` +This ensures that the required database tables exist, which must be the case before data can be imported. + ### Import Data The new database should now be correctly initialized with the correct table structures requried to import the data. Run the following command to load the databased dump file into the new database. ``` -python3 InvenTree/manage.py loaddata data.json +invoke import-records -f data.json ``` -!!! info "Character Encoding" +!!! info "Import Filename" + A different filename can be specified using the `-f` option + +!!! warning "Character Encoding" If the character encoding of the data file does not exactly match the target database, the import operation may not succeed. In this case, some manual editing of the database JSON file may be required.