···4455---
6677+
88+99+710# Welcome to Kefi community!
81199-## Run in local
1212+## Basic setup
10131114To be able to run Kefi in you own computer, for development proposes, first, you'll
1215need the following software installed and configured:
···17201821This project uses environment variables to handle the configuration, following the [twelve-factor config recommendation](https://12factor.net/config), and we recommend to use [direnv](https://direnv.net/) to handle project's local environment variables.
19222020-### 1. Clone the repository
2323+### Clone the repository
21242225First, just clone this repository in your machine.
23262424-### 2. Create environment variables
2727+### Create environment variables
25282629Assuming you are using [direnv](https://direnv.net/), on the root of the project, creates a file named `.envrc`:
27303131+```bash
2832 $ echo "dotenv" > .envrc
3333+```
29343035Then create an `.env` file with the environment variables. An example:
31363737+```
3238 # PostgreSQL
3339 # ------------------------------------------------------------------------------
3440 POSTGRES_HOST=localhost
···47534854 # Slack
4955 # ------------------------------------------------------------------------------
5050- SLACK_BOT_TOKEN=
5151- SLACK_TEAM_ID=
5656+ SLACK_BOT_TOKEN=<put here your bot token>
5757+ SLACK_TEAM_ID=<put here your team ID>
52585359 # General
5460 # ------------------------------------------------------------------------------
5561 KEFI_SETTINGS_MODULE=kefi.config.local
5656-6262+```
57635858-### 3. Launch the external services
6464+### Launch the external services
59656066To launch the database an Redis server, you can launch them using `docker-compose`:
61676868+```bash
6269 $ docker-compose up --build
7070+```
63716464-### 4. Install the dependencies
7272+### Install the dependencies
65736674You can install the dependencies of the project using [poetry](https://python-poetry.org/),
6775in a local virtual environment, using the following command:
68767777+```bash
6978 $ poetry install
7979+```
70807171-### 5. Run tests
8181+## Running tests
72827383Now, to test that everything is working, you can launch the tests using this command:
74847575- poetry run pytest .8585+```bash
8686+ $ poetry run pytest .
8787+```
8888+8989+## Running local server
9090+9191+### Database migrations
9292+9393+First, we have to run the migrations in order to get the last version of the database:
9494+9595+```bash
9696+ $ poetry run alembic upgrade head
9797+```
9898+9999+### Run server
100100+101101+Then, we launch the local server with `uvicorn`:
102102+```bash
103103+ $ poetry run uvicorn kefi.main:app --reload
104104+```
105105+106106+### Force load Kefis
107107+108108+```bash
109109+ $ poetry run ./manage.py
110110+```
111111+112112+```python
113113+ from kefi.models.helpers import reset_wallets
114114+ reset_wallets(session)
115115+ session.commit()
116116+```
···11+from kefi.models.plazas.helpers import notify_plaza, select_current_plaza
22+33+44+async def runs_plaza(ctx):
55+ """Task to runs the plaza, that means, create the groups and send the call."""
66+ session = ctx["session"]
77+ plaza = select_current_plaza(session=session)
88+ if plaza:
99+ notify_plaza(session=session, plaza=plaza)
1010+ # In case the helper saves info
1111+ ctx["session"].commit()