2
0
mirror of https://github.com/inventree/inventree-docs.git synced 2025-04-28 13:46:54 +00:00
Oliver Walters bb99884d68 Begin deployment docs
(cherry picked from commit dd27ae2dd83256799147ab06f8f57b4d1f920d8e)
2021-04-08 21:17:58 +10:00

106 lines
3.8 KiB
Markdown

---
title: Installation Instructions
---
## Development Server
The following installation instructions can be used to install InvenTree and run a server which provides a simple development environment.
!!! warning "Deployment"
Refer to the [deployment instructions](../deploy) to implement a much more robust server setup.
## Download Code
InvenTree setup is performed using the [invoke](https://www.pyinvoke.org/) Python build tool. Various useful scripts are defined in the `tasks.py` file.
Install invoke as follows:
```
pip3 install invoke
```
!!! warning "Invoke Version"
InvenTree requires invoke version 1.4.0 or newer. Some platforms may be shipped with older versions of invoke!
To display a list of the available configuration scripts, run the following command:
```
inv --list
```
## Installation
Now that the source code is downloaded (and optionally you have configured a Python virtual environment), the Python packages required to run InvenTree can be installed. InvenTree is a Python/Django application and relies on the pip package manager. All packages required to develop and test InvenTree are installed via pip. Package requirements can be found in ``requirements.txt``.
To setup the InvenTree environment, run the following commands (from the InvenTree source directory):
```
inv install
```
This 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).
Additionally, this step creates a *SECRET_KEY* file which is used for the django authentication framework.
!!! warning "Keep it secret, keep it safe"
The SECRET_KEY file should never be shared or made public.
### Database Configuration
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.
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.
For further information on installation configuration, refer to the [Configuration](../config) section.
!!! warning "Configure Database"
Ensure database settings are correctly configured in `config.yaml` before proceeding to the next step!
### Initialize Database
Once install settings are correctly configured (in *config.yaml*) run the initial setup script:
```
inv migrate
```
This performs the initial database migrations, creating the required tables, etc.
The database should now be installed!
### Create Admin Account
Create an initial superuser (administrator) account for the InvenTree instance:
```
inv superuser
```
!!! warning "Solving Cairo Errors"
In the case the above command returns errors with the `Cairo` package, it implies that dependencies for the `weasyprint` package are not installed on the system. To solve them, run through the [weasyprint installation steps](https://weasyprint.readthedocs.io/en/stable/install.html) then re-run `inv install` and `inv superuser`.
### Run Development Server
The InvenTree database is now setup and ready to run. A simple development server can be launched from the command line.
To launch the development server, run the following commands:
```
inv server
```
For more server options, run:
```
inv server -h
```
This will launch the InvenTree web interface at `http://127.0.0.1:8000`. For other options refer to the [django docs](https://docs.djangoproject.com/en/2.2/ref/django-admin/)
### Run Production Server
For a production install, refer to [deployment instructions](../deploy).