InvenTree/docs/start.rst

89 lines
3.6 KiB
ReStructuredText
Raw Normal View History

Getting Started Guide
=====================
.. toctree::
:titlesonly:
:maxdepth: 2
:caption: Getting Started
:hidden:
2019-07-10 13:11:41 +00:00
To install a complete *development* environment for InvenTree, follow the steps presented below. A production environment will require further work as per the particular application requirements.
A makefile in the root directory provides shortcuts for the installation process, and can also be very useful during development.
2019-09-01 12:16:58 +00:00
Requirements
------------
To install InvenTree you will need the following:
* python3
* pip3
* make
Installation
------------
2019-09-01 12:16:58 +00:00
First, download the latest InvenTree source code:
``git clone https://github.com/inventree/inventree/``
2019-07-10 13:11:41 +00:00
InvenTree is a Python/Django application and relies on the pip package manager. All packages required to develop and test InvenTree can be installed via pip. Package requirements can be found in ``requirements.txt``.
2019-09-01 12:16:58 +00:00
To setup the InvenTree environment, *cd into the inventree directory* and run the command:
``make install``
2019-09-01 12:16:58 +00:00
which installs all required Python packages using pip package manager. It also creates a (default) database configuration file which needs to be edited to meet user needs before proceeding (see next step below).
2019-09-01 12:16:58 +00:00
Additionally, this step creates a *SECREY_KEY* file which is used for the django authentication framework.
2019-09-01 12:16:58 +00:00
.. important::
The *SECREY_KEY* file should never be shared or made public.
Database Configuration
-----------------------
2019-07-10 13:11:41 +00:00
2019-09-01 12:16:58 +00:00
Once the required packages are installed, the database configuration must be adjusted to suit your particular needs. InvenTree provides a simple default setup which should work *out of the box* for testing and debug purposes.
2019-07-10 13:11:41 +00:00
2019-09-01 12:16:58 +00:00
As part of the previous *install* step, a configuration file (*config.yaml*) is created. The configuration file provides administrators control over various setup options without digging into the Django ``settings.py`` script. The default setup uses a local sqlite database with *DEBUG* mode enabled.
2019-07-10 13:11:41 +00:00
For further information on installation configuration, refer to the `Configuration <config.html>`_ section.
2019-09-01 12:16:58 +00:00
Initialize Database
-------------------
Once install settings are correctly configured (in *config.yaml*) run the initial setup script:
``make setup``
which performs the following functions:
* Run initial database migrations, creating the required tables, etc
* Create initial administrator account
The database should now be installed!
Run Development Server
----------------------
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 <https://docs.djangoproject.com/en/2.2/ref/django-admin/>`_.
Database Migrations
-------------------
Whenever a change is made to the underlying database schema, database migrations must be performed. Call ``make migrate`` to run any outstanding database migrations.
Development and Testing
-----------------------
Other shorthand functions are provided for the development and testing process:
* ``make requirements`` - Install all required underlying packages using PIP
2019-08-14 02:54:38 +00:00
* ``make setup`` - Perform one-time setup functions
* ``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)
2019-09-01 12:16:58 +00:00
* ``make docreqs`` - Install the packages required to generate documentation
* ``make docs`` - Generate this documentation