Merge remote-tracking branch 'inventree/master'

This commit is contained in:
Oliver Walters 2019-09-09 16:20:01 +10:00
commit 0a4f7a55b8
3 changed files with 24 additions and 8 deletions

View File

@ -34,10 +34,14 @@ superuser:
# Install pre-requisites for mysql setup # Install pre-requisites for mysql setup
mysql: mysql:
apt-get install mysql-server apt-get install mysql-server libmysqlclient-dev
apt-get install libmysqlclient-dev
pip3 install mysqlclient pip3 install mysqlclient
# Install pre-requisites for postgresql setup
postgresql:
apt-get install postgresql postgresql-contrib libpq-dev
pip3 install psycopg2
# Run PEP style checks against source code # Run PEP style checks against source code
style: style:
flake8 InvenTree flake8 InvenTree
@ -66,4 +70,4 @@ backup:
python3 InvenTree/manage.py dbbackup python3 InvenTree/manage.py dbbackup
python3 InvenTree/manage.py mediabackup python3 InvenTree/manage.py mediabackup
.PHONY: clean migrate superuser install mysql style test coverage docreqs docs backup update .PHONY: clean migrate superuser install mysql postgresql style test coverage docreqs docs backup update

View File

@ -26,11 +26,11 @@ InvenTree provides support for multiple database backends - any backend supporte
Database options are specified under the *database* heading in the configuration file. Any option available in the Django documentation can be used here - it is passed through transparently to the management scripts. Database options are specified under the *database* heading in the configuration file. Any option available in the Django documentation can be used here - it is passed through transparently to the management scripts.
**SQLITE:** **SQLite:**
By default, InvenTree uses an sqlite database file : ``inventree_db.sqlite3``. This provides a simple, portable database file that is easy to use for debug and testing purposes. By default, InvenTree uses an sqlite database file : ``inventree_db.sqlite3``. This provides a simple, portable database file that is easy to use for debug and testing purposes.
**MYSQL:** MySQL database backend is supported with the native Django implemetation. To run InvenTree with the MySQL backend, a number of extra packages need to be installed: **MySQL:** MySQL database backend is supported with the native Django implemetation. To run InvenTree with the MySQL backend, a number of extra packages need to be installed:
* mysql-server - *MySQL backend server* * mysql-server - *MySQL backend server*
* libmysqlclient-dev - *Required for connecting to the MySQL database in Python* * libmysqlclient-dev - *Required for connecting to the MySQL database in Python*
@ -38,14 +38,25 @@ By default, InvenTree uses an sqlite database file : ``inventree_db.sqlite3``. T
These requirements can be installed from the base directory with the command ``make mysql``. These requirements can be installed from the base directory with the command ``make mysql``.
It is up to the database adminstrator to create a new database to store inventree data, in addition to a username/password to access the data. It is then up to the database adminstrator to create a new MySQL database to store inventree data, in addition to a username/password to access the data.
.. important:: MySQL Collation: .. important:: MySQL Collation:
When creating the MySQL database, the adminstrator must ensure that the collation option is set to *utf8_unicode_520_ci* to ensure that InvenTree features function correctly. When creating the MySQL database, the adminstrator must ensure that the collation option is set to *utf8_unicode_520_ci* to ensure that InvenTree features function correctly.
The database options then need to be adjusted to communicate the MySQL backend. Refer to the `Django docs <https://docs.djangoproject.com/en/dev/ref/databases/>`_ for further information. The database options (in the ``config.yaml`` file) then need to be adjusted to communicate the MySQL backend. Refer to the `Django docs <https://docs.djangoproject.com/en/dev/ref/databases/>`_ for further information.
**POSTGRESQL:** PostgreSQL database backend is supported with the native Django implementation. Note that to use this backend, the ``psycopg2`` Python library must first be installed. **PostgreSQL:** PostgreSQL database backend is supported with the native Django implementation. Note that to use this backend, the following system packages must be installed:
* postgresql
* postgresql-contrib
* libpq-dev
* (pip3) psycopg2
These requirements can be installed from the base directory with the command ``make postgresql``.
It is then up to the database adminstrator to create a new PostgreSQL database to store inventree data, in addition to a username/password to access the data.
The database options (in the ``config.yaml`` file) then need to be adjusted to communicate the PostgreSQL backend. Refer to the `Django docs <https://docs.djangoproject.com/en/dev/ref/databases/>`_ for further information.
Allowed Hosts / CORS Allowed Hosts / CORS
-------------------- --------------------

View File

@ -87,6 +87,7 @@ Other shorthand functions are provided for the development and testing process:
* ``make superuser`` - Create a superuser account * ``make superuser`` - Create a superuser account
* ``make migrate`` - Perform database migrations * ``make migrate`` - Perform database migrations
* ``make mysql`` - Install packages required for MySQL database backend * ``make mysql`` - Install packages required for MySQL database backend
* ``make postgresql`` - Install packages required for PostgreSQL database backend
* ``make backup`` - Backup database tables and media files * ``make backup`` - Backup database tables and media files
* ``make test`` - Run all unit tests * ``make test`` - Run all unit tests
* ``make coverage`` - Run all unit tests and generate code coverage report * ``make coverage`` - Run all unit tests and generate code coverage report