Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Update README with local development steps (#17331)
Krzysztof Żuraw52b5790f1c99
diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfileindex c063b93f37..d2cd799fed 100644--- a/.devcontainer/Dockerfile+++ b/.devcontainer/Dockerfile@@ -20,4 +20,4 @@ WORKDIR /appRUN pip install poetry==2.0.1RUN poetry config virtualenvs.create falseCOPY poetry.lock pyproject.toml /app/-RUN poetry sync+RUN poetry installdiff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.jsonindex a85f619e45..9ff09863a7 100644--- a/.devcontainer/devcontainer.json+++ b/.devcontainer/devcontainer.json@@ -6,7 +6,8 @@"forwardPorts": [8000,"dashboard:9000",- "mailpit:8025"+ "mailpit:8025",+ "db:5432"],"portsAttributes": {"8000": {@@ -17,6 +18,9 @@},"mailpit:8025": {"label": "Mailpit UI"+ },+ "db:5432": {+ "label": "PostgreSQL"}},"postCreateCommand": "python manage.py migrate",diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.ymlindex 92d3262c5c..89e3c4464c 100644--- a/.devcontainer/docker-compose.yml+++ b/.devcontainer/docker-compose.yml@@ -24,6 +24,8 @@ services:db:image: library/postgres:15-alpine+ ports:+ - 5432:5432restart: unless-stoppedvolumes:- saleor-db:/var/lib/postgresql/datadiff --git a/README.md b/README.mdindex eaf060253c..81542e8e88 100644--- a/README.md+++ b/README.md@@ -51,11 +51,14 @@## Table of Contents- [What makes Saleor special?](#what-makes-saleor-special)+- [Why API-only Architecture?](#why-api-only-architecture)- [Features](#features)- [Installation](#installation)- [Documentation](#documentation)+- [Saleor Platform](#saleor-platform)+- [Storefront](#storefront)+- [Dashboard](#dashboard)- [Contributing](#contributing)-- [Your feedback](#your-feedback)- [License](#license)## What makes Saleor special?@@ -168,10 +171,109 @@ For the dashboard, go to the [saleor-dashboard](https://github.com/saleor/saleorWe love your contributions and do our best to provide you with mentorship and support. If you are looking for an issue to tackle, take a look at issues labeled [`Good first issue`](https://github.com/saleor/saleor/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22+)-If nothing grabs your attention, check [our roadmap](https://github.com/orgs/saleor/projects/3/views/4) or come up with your feature. Just drop us a line or [open an issue](https://github.com/saleor/saleor/issues/new) and we’ll work out how to handle it.-Get more details in our [Contributing Guide](https://docs.saleor.io/docs/developer/community/contributing).+### Running Saleor locally in development containers++The easiest way of running Saleor for local development is to use [development containers](https://containers.dev/).+If you have Visual Studio Code follow their [guide](https://code.visualstudio.com/docs/devcontainers/containers#_quick-start-open-an-existing-folder-in-a-container) on how to open existing folder in container.++Development container only creates container, you still need to start the server. See [common-commands](#common-commands) section to learn more.++### Running Saleor locally with database and additional services in docker++Install & setup prerequisites via homebrew:++```shell+brew install libmagic+brew install pyenv++pyenv install 3.12++# optionally set python globally+pyenv global 3.12++brew install pipx+pipx install poetry+```++Clone this [repository](https://github.com/saleor/saleor) and setup database and additional services in docker:++```shell+cd .devcontainer+docker compose up db dashboard redis mailpit+```+++If you didn’t set python version globally set [pyenv](https://github.com/pyenv/pyenv) local version:++```shell+pyenv local 3.12+```++To create virtualenv and install dependencies run in root of the repository:++```shell+poetry sync+```++After installation activate virtualenv:++```shell+eval $(poetry env activate)+```++See [poetry docs](https://python-poetry.org/docs/managing-environments/#bash-csh-zsh) for all supported shells.++> [!TIP]+> Your shell prompt should have virtualenv information available and should look similar to this:+> `(saleor-py3.12) ~/D/saleor %`++Install pre commit hooks:++```shell+pre-commit install+```++You are ready to go 🎉.++### Running tests++To run tests, enter pytest in your terminal.++```shell+pytest+```++We recommend using the reuse-db flag to speed up testing time.++```shell+pytest --reuse-db+```++### Common commands++To start server:++```shell+uvicorn saleor.asgi:application --reload+```++To run database migrations:++```shell+python manage.py migrate+```++To populate database with example data and create the admin user:++```shell+python manage.py populatedb --createsuperuser+```++*Note that `--createsuperuser` argument creates an admin account for `[email protected]` with the password set to `admin`.*++## LicenseDisclaimer: Everything you see here is open and free to use as long as you comply with the [license](https://github.com/saleor/saleor/blob/master/LICENSE). There are no hidden charges. We promise to do our best to fix bugs and improve the code.