forked from data.coop/membersystem
101 lines
1.9 KiB
Markdown
101 lines
1.9 KiB
Markdown
# data.coop member system
|
|
|
|
## Development setup
|
|
|
|
There are two ways to setup the development environment.
|
|
|
|
- Using the Docker Compose setup provided in this repository.
|
|
- Using [hatch](https://hatch.pypa.io/) in your host OS.
|
|
|
|
### Using Docker Compose
|
|
|
|
Working with the Docker Compose setup is made easy with the `Makefile` provided in the repository.
|
|
|
|
#### Requirements
|
|
|
|
- Docker
|
|
- docker compose plugin
|
|
|
|
#### Setup
|
|
|
|
1. Setup .env file
|
|
|
|
An example .env file is provided in the repository. You can copy it to .env file using the following command:
|
|
|
|
```bash
|
|
cp .env.example .env
|
|
```
|
|
|
|
The default values in the .env file are suitable for the docker-compose setup.
|
|
|
|
2. Migrate
|
|
|
|
```bash
|
|
make migrate
|
|
```
|
|
|
|
3. Run the development server
|
|
|
|
```bash
|
|
make run
|
|
```
|
|
|
|
#### Building and running other things
|
|
|
|
```bash
|
|
# Build the containers
|
|
make build
|
|
|
|
# Create a superuser
|
|
make createsuperuser
|
|
|
|
# Create Django migrations (after this, maybe you need to change file permissions in volume)
|
|
make makemigrations
|
|
```
|
|
|
|
### Using hatch
|
|
|
|
#### Requirements
|
|
|
|
- Python 3.12 or higher
|
|
- [hatch](https://hatch.pypa.io/) (Recommended way to install is using `pipx install hatch`)
|
|
- A running PostgreSQL server
|
|
|
|
#### Setup
|
|
|
|
1. Setup .env file
|
|
|
|
An example .env file is provided in the repository. You can copy it to .env file using the following command:
|
|
|
|
```bash
|
|
cp .env.example .env
|
|
```
|
|
|
|
Edit the .env file and set the values for the environment variables, especially the database variables.
|
|
|
|
2. Run migrate
|
|
|
|
```bash
|
|
hatch run dev:migrate
|
|
```
|
|
|
|
3. Run the development server
|
|
|
|
```bash
|
|
hatch run dev:server
|
|
```
|
|
|
|
#### Upgrade requirements
|
|
|
|
We use hatch-pip-compile.
|
|
|
|
```bash
|
|
# Install hatch-pip-compile in some environment
|
|
pipx install hatch-pip-compile
|
|
# Change requirements in pyproject.toml (...)
|
|
# Update requirements.txt:
|
|
hatch-pip-compile
|
|
# Update requirements/requirements-dev.txt:
|
|
hatch-pip-compile dev
|
|
```
|