Move django project to `server` directory
This commit is contained in:
parent
92f88f2d3d
commit
425273c5a3
|
|
@ -13,9 +13,9 @@ FROM node:16-bullseye-slim as client-builder
|
|||
ARG APP_HOME=/app
|
||||
WORKDIR ${APP_HOME}
|
||||
|
||||
COPY ./package.json ${APP_HOME}
|
||||
COPY ./server/package.json ${APP_HOME}
|
||||
RUN npm install && npm cache clean --force
|
||||
COPY . ${APP_HOME}
|
||||
COPY ./server ${APP_HOME}
|
||||
RUN npm run build
|
||||
|
||||
# define an alias for the specfic python version used in this file.
|
||||
|
|
@ -34,7 +34,7 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
|
|||
libpq-dev
|
||||
|
||||
# Requirements are installed here to ensure they will be cached.
|
||||
COPY ./requirements .
|
||||
COPY ./server/requirements .
|
||||
|
||||
# Create Python Dependency and Sub-Dependency Wheels.
|
||||
# FIXME should we also use requirements-dev.txt in prod?
|
||||
|
|
|
|||
|
|
@ -0,0 +1,50 @@
|
|||
# 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.
|
||||
|
|
@ -299,7 +299,7 @@ else:
|
|||
'handlers': {
|
||||
'file': {
|
||||
'class': 'concurrent_log_handler.ConcurrentRotatingFileHandler',
|
||||
'filename': f'{SERVER_ROOT_DIR}/log/myservice.log',
|
||||
'filename': f'{SERVER_ROOT_DIR}/myservice.log',
|
||||
'maxBytes': 1024 * 1024 * 100,
|
||||
'backupCount': 50,
|
||||
'formatter': 'json',
|
||||
|
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 8.2 KiB |
Loading…
Reference in New Issue