Saleor

There are 2 ways to install Saleor:

  • Use a docker image (Saleor recommended)
  • You install the environment yourself.
  1. Using docker:

** Note: docker only runs on windows 10 64 bit

– To use docker image, you need to install docker first. Link to download docker installation file [click here]

– After installing docker, you need to clone and build docker

git clone https://github.com/mirumee/saleor-platform.git –recursive –jobs3

cd saleor-platform docker-compose build

Saleor uses shared folders to enable live code functionality. If you are using Windows or MacOS do the following:

Add the saleor-platform directory to the list of shared directories in docker (Preferences -> Resources -> File sharing).

Make sure that in Docker preferences you have set aside 5G ram for docker (Preferences -> Resources -> Advanced).

Then run apply database migration and collect static assets:

docker-compose run –rm api python3 manage.py migrate

docker-compose run –rm api python3 manage.py collectstatic –noinput

You can install sample data with the following command:

docker-compose run –rm api python3 manage.py populatedb

Finally run the following command to create superadmin

docker-compose run –rm api python3 manage.py createsuperuser

To run services, go to the saleor-platform directory and run the following command

docker-compose up

Before starting to install Saleor, you need to install:

Python 3.8 or latest. Click to download python 3.8: Python download page . Make sure you select “Add Python 3.8 to PATH” when installing

Node.js 10.0 or later. Click to download (recommended to download msi file) Node.js downloads page

PostgreSQL 12.x. Click to download the project’s download page.

GTK+ . Download and install: 64-bit Windows installer . Make sure you select “Set up PATH environment variable to include GTK+ ”

Compilers. Download and install: Build Tools for Visual Studio.

II.Installation:

Clone repository

git clone https://github.com/mirumee/saleor.git cd saleor

Create python env and install package

python -m venv saleor-venv saleor-venv\Scripts\activate.bat python -m pip install -r requirements.txt

2.1 In this step, if you use Anaconda, do the following:

Open Anaconda navigator > Environments > Create > select as shown then press create

  • Open terminal then cd to the above cloned git directory and run command pip install -r requirements.txt
  • If successful, you will get the same, if there are any errors, please join the Python Community Vietnam group for help
  • .
  1. Create database user:

** Note: your machine path may be different. Please correct it

C:\”Program Files”\PostgreSQL\12\bin\createuser.exe –username=postgres –superuser –pwprompt saleor

Create database:

C:\”Program Files”\PostgreSQL\12\bin\createdb.exe –username=postgres –owner=saleor saleor

Run the migrate command:

** Note you must active python env installed package in step 2

python manage.py migrate

** In this step, if you set a different password than the instructions, then follow the steps below. Note: characters with #@! will be error

Go to salor clone folder > saleor > settings.py

find

default=”postgres://saleor:saleor@localhost:5432/saleor”

change into

default=”postgres://saleor:newpassword@localhost:5432/saleor”

Run the following command to create the admin user

python manage.py createsuperuser

To run the API server:

python manage.py runserver

Dashboard settings

git clone https://github.com/mirumee/saleor-dashboard.git

cd saleor-dashboard

Set API URI with command:

set API_URI “http://localhost:8000/graphql/”

If you can’t set API_URI, then create .env file in saler-dashboard folder and paste this content in

API_URI = “http://localhost:8000/graphql/”

Then run command

npm install -f

Still in the saler-dashboard folder, run the command:

npm start

** If this step fails, check if there is a npm path in PATH, if it is still there, open a new cmd

*** In this step, please note that if the terminal shows the content as below, you just need to wait for about 3-5 minutes.

i wds」: Project is running at http://localhost:9000/

i wds」: webpack output is served from /

i 「wds」: Content not from webpack is served from D:\Workspace\python\saleor\saleor-dashboard\build\dashboard\

i wds」: 404s will fallback to /index.html

Browserslist: caniuse-lite is outdated. Please run next command `npm update`

i 「wdm」: wait until bundle finished: /i 「wdm」: wait until bundle finished: /

Install Storefront

Clone the repository:

git clone https://github.com/mirumee/saleor-storefront.git cd saleor-storefront

Install npm package with command npm install

If you use .env above, then create .env file in saler-storefront folder and paste this content in

API_URI = “http://localhost:8000/graphql/”

Run Storefront service npm start

After the services are finished running, you will enter the admin and frontend using the links below:

Admin url: http://localhost:9000/

Frontend url: http://localhost:3000/

This is the default frontend and backend upon successful installation.

If you encounter errors when installing, or have any questions, please post a question on the Python Community Vietnam group for everyone to discuss.

Buy us some coffee

Thank You for your support as we work to give you the best of guides and articles.

top