Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(Django): Updated project setup instruction #432

Merged
merged 3 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 27 additions & 26 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,48 @@
# HOWTO install/test Open Prices API
# HOW TO install/test Open Prices API

## Prerequisites

- Python 3.11 (lower version may be OK, but untested)
- PostgreSQL 13 (lower version may be OK, but untested)
* Python 3.11 (lower version may be OK, but untested)
* PostgreSQL 13 (lower version may be OK, but untested)

## Setup

### Without Docker

```
# clone repo
# Clone repo
git clone https://github.com/openfoodfacts/open-prices.git
cd open-prices

# install poetry (Python dependency manager) at version 1.6.1
# Copy .env.example to .env

```

### Without Docker

```
# Install poetry (Python dependency manager) at version 1.6.1
# see https://python-poetry.org/docs/

# install dependencies (pyproject.toml)
# Install dependencies (pyproject.toml)
poetry install

# note: all future commands should be prefixed with `poetry run`
# Note:
All future commands should be prefixed with `poetry run`

# Apply migrations
python manage.py migrate

# run migrations
alembic upgrade head
# Run Locally
python manage.py runserver

# Now server will run on http://127.0.0.1:8000/ but you can change the port as
python manage.py runserver 8001
Will run on http://127.0.0.1:8001/
```

### With Docker

:::info
Open Prices now only supports docker compose v2 (`docker compose`)
::: Info
Open Prices now only supports docker compose v2 ( `docker compose` )
:::

create the dockers with
Expand All @@ -38,7 +51,7 @@ create the dockers with
docker compose up
```

The sever should be running on <http://localhost:8000/>.
The sever should be running on <http://127.0.0.1:8000/>.

The run the migration of the database with

Expand All @@ -47,15 +60,3 @@ make migrate-db
```

Congrats, you can now contribute to the codebase :tada:

## Run locally

```
uvicorn app.api:app --reload
```

or use `--host` if you want to make it available on your local network, eg.:

```
uvicorn app.api:app --reload --host 192.168.0.100
```
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ A REST API designed to interact with the Open Food Facts _Open Prices_ database.
## Dependencies

* Python 3.11
* [FastAPI](https://fastapi.tiangolo.com/) framework
* [Django](https://www.djangoproject.com/) framework
* PostgreSQL database

## How to install on your local machine
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Open Prices is a project to collect and share prices of food products around the

It consists of:

- a REST API, built using FastAPI (repo: [`open-prices`](https://github.com/openfoodfacts/open-prices))
- a REST API, built using Django (repo: [`open-prices`](https://github.com/openfoodfacts/open-prices))
- a [web interface](https://prices.openfoodfacts.org/app/), built using Vue.js (repo: [`open-prices-frontend`](https://github.com/openfoodfacts/open-prices-frontend))

If you're a contributor, have a look at our tutorials to add a [single](add-a-price.md) or [multiple](add-multiple-prices.md) prices!
Loading