Installation for Linux¶
Note
If you prefer using containers or have problems with configuring PostgreSQL, Redis and Elasticsearch, try Using Docker for Development instructions.
Prerequisites¶
Before you are ready to run Saleor you will need additional software installed on your computer.
Python 3¶
Saleor requires Python 3.6 or later. A compatible version comes preinstalled with most current Linux systems. If that is not the case consult your distribution for instructions on how to install Python 3.6 or 3.7.
Node.js¶
Version 10 or later is required. See the installation instructions.
PostgreSQL¶
Saleor needs PostgreSQL version 9.4 or above to work. Use the PostgreSQL download page to get instructions for your distribution.
Gtk+¶
Some features like PDF creation require that additional system libraries are present.
Debian / Ubuntu¶
Debian 9.0 Stretch or newer, Ubuntu 16.04 Xenial or newer:
$ sudo apt-get install build-essential python3-dev python3-pip python3-cffi libcairo2 libpango-1.0-0 libpangocairo-1.0-0 libgdk-pixbuf2.0-0 libffi-dev shared-mime-info
Fedora¶
$ sudo yum install redhat-rpm-config python-devel python-pip python-cffi libffi-devel cairo pango gdk-pixbuf2
Archlinux¶
$ sudo pacman -S python-pip cairo pango gdk-pixbuf2 libffi pkg-config
Gentoo¶
$ emerge pip cairo pango gdk-pixbuf cffi
Installation¶
Clone the repository (or use your own fork):
$ git clone https://github.com/mirumee/saleor.gitEnter the directory:
$ cd saleor/
Install all dependencies:
We strongly recommend creating a virtual environment before installing any Python packages.
$ pip install -r requirements.txtSet
SECRET_KEYenvironment variable.We try to provide usable default values for all of the settings. We’ve decided not to provide a default for
SECRET_KEYas we fear someone would inevitably ship a project with the default value left in code.$ export SECRET_KEY='<mysecretkey>'
Warning
Secret key should be a unique string only your team knows. Running code with a known
SECRET_KEYdefeats many of Django’s security protections, and can lead to privilege escalation and remote code execution vulnerabilities. Consult Django’s documentation for details.Create a PostgreSQL user:
See PostgreSQL’s createuser command for details.
Note
You need to create the user to use within your project. Username and password are extracted from the
DATABASE_URLenvironmental variable. If absent they both default tosaleor.Warning
While creating the database Django will need to create some PostgreSQL extensions if not already present in the database. This requires a superuser privilege.
For local development you can grant your database user the
SUPERUSERprivilege. For publicly available systems we recommend using a separate privileged user to perform database migrations.Create a PostgreSQL database
See PostgreSQL’s createdb command for details.
Note
Database name is extracted from the
DATABASE_URLenvironment variable. If absent it defaults tosaleor.Prepare the database:
$ python manage.py migrateWarning
This command will need to be able to create database extensions. If you get an error related to the
CREATE EXTENSIONcommand please review the notes from the user creation step.Install front-end dependencies:
$ npm installNote
If this step fails go back and make sure you’re using new enough version of Node.js.
Prepare front-end assets:
$ npm run build-assetsCompile e-mails:
$ npm run build-emailsStart the development server:
$ python manage.py runserver