# VBV Lernwelt

Project setup is based on [cookiecutter-django](https://github.com/cookiecutter/cookiecutter-django) project template.

## Run for development

```bash
# run vue vite dev server
cd client && npm run dev

# reset db and run django dev server
./prepare_server.sh

# run tailwind cli (for tailwind support on django templates)
cd client && npm run tailwind 
```

## Installation

See `.tool-versions` file for used django and node version

You have to set up at least the following environment variables:

```bash
export IT_APP_ENVIRONMENT=development
```

See `.env_secrets/local_daniel.env` for more possible environment variables.
Especially set correct values for `POSTGRES_*` and `DATABASE_URL`


### Server part

Install python dependencies:

```bash
pip install -r server/requirements/requirements-dev.txt
```

The "prepare_server.sh" script will create the database according to `POSTGRES_*` environment variables.
It will also setup the tables for django and run the django development server.

```bash
# will initial`migrate` and `runserver` etc...
./prepare_server.sh

# or async server
# uvicorn config.asgi:application --host 0.0.0.0 --reload
```

### Client part

```bash
cd client

npm install

# run dev server
npm run dev
```

### General part

Cypress is installed for client and server, so there is this package.json on the project root directory

```bash
# in project root directory
npm install
```


## Deployment to CapRover

```
# run deploy script
./caprover_deploy.sh
```

## IntelliJ Configuration

* In the .idea/vbv_lernwelt.iml file change the module type to "PYTHON_MODULE".
* Add django facet in "Project Structure".
* Run configuration with "Python -> server.py" to have async debugging support.

### Optional

#### Install the EnvFile Plugin

![](docs/envfile_plugin_settings.png)

#### Install the tailwind css Plugin from Jetbrains
