vbv/server/README.md

51 lines
1.2 KiB
Markdown

# VBV Lernwelt
Project setup is based on [cookiecutter-django](https://github.com/cookiecutter/cookiecutter-django) project template.
## Installation
See `.tool-versions` file for used django and node version
Create a new PostgreSQL database and role
```bash
createdb vbv_lernwelt
createuser vbv_lernwelt
```
Set the environment variable accordingly
```bash
export VBV_DATABASE_URL='postgres://vbv_lernwelt@localhost:5432/vbv_lernwelt'
```
Set `VBV_DJANGO_READ_DOT_ENV_FILE=True` to make the config read the `example.env` file (with direnv!?).
Apply migrations and run async server
```bash
python manage.py migrate
# sync server
python manage.py runserver
# or async server
uvicorn config.asgi:application --host 0.0.0.0 --reload
```
## SASS Live-Reloading
```bash
# start django server...
# live reloading is hardcoded via proxy to port 8000 -> django server must get started manually
npm run dev
# open site with http://localhost:3000
```
## 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.