diff --git a/compose/django/Dockerfile b/compose/django/Dockerfile index ac6b8167..dbd61353 100644 --- a/compose/django/Dockerfile +++ b/compose/django/Dockerfile @@ -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? diff --git a/server/README.md b/server/README.md new file mode 100644 index 00000000..eadebd29 --- /dev/null +++ b/server/README.md @@ -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. diff --git a/config/__init__.py b/server/config/__init__.py similarity index 100% rename from config/__init__.py rename to server/config/__init__.py diff --git a/config/api_router.py b/server/config/api_router.py similarity index 100% rename from config/api_router.py rename to server/config/api_router.py diff --git a/config/asgi.py b/server/config/asgi.py similarity index 100% rename from config/asgi.py rename to server/config/asgi.py diff --git a/config/settings/__init__.py b/server/config/settings/__init__.py similarity index 100% rename from config/settings/__init__.py rename to server/config/settings/__init__.py diff --git a/config/settings/base.py b/server/config/settings/base.py similarity index 99% rename from config/settings/base.py rename to server/config/settings/base.py index dd61637d..5dabee96 100644 --- a/config/settings/base.py +++ b/server/config/settings/base.py @@ -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', diff --git a/config/settings/test.py b/server/config/settings/test.py similarity index 100% rename from config/settings/test.py rename to server/config/settings/test.py diff --git a/config/urls.py b/server/config/urls.py similarity index 100% rename from config/urls.py rename to server/config/urls.py diff --git a/config/websocket.py b/server/config/websocket.py similarity index 100% rename from config/websocket.py rename to server/config/websocket.py diff --git a/config/wsgi.py b/server/config/wsgi.py similarity index 100% rename from config/wsgi.py rename to server/config/wsgi.py diff --git a/example.env b/server/example.env similarity index 100% rename from example.env rename to server/example.env diff --git a/gulpfile.js b/server/gulpfile.js similarity index 100% rename from gulpfile.js rename to server/gulpfile.js diff --git a/locale/README.rst b/server/locale/README.rst similarity index 100% rename from locale/README.rst rename to server/locale/README.rst diff --git a/manage.py b/server/manage.py similarity index 100% rename from manage.py rename to server/manage.py diff --git a/package.json b/server/package.json similarity index 100% rename from package.json rename to server/package.json diff --git a/pytest.ini b/server/pytest.ini similarity index 100% rename from pytest.ini rename to server/pytest.ini diff --git a/requirements/README.md b/server/requirements/README.md similarity index 100% rename from requirements/README.md rename to server/requirements/README.md diff --git a/requirements/requirements-dev.in b/server/requirements/requirements-dev.in similarity index 100% rename from requirements/requirements-dev.in rename to server/requirements/requirements-dev.in diff --git a/requirements/requirements-dev.txt b/server/requirements/requirements-dev.txt similarity index 100% rename from requirements/requirements-dev.txt rename to server/requirements/requirements-dev.txt diff --git a/requirements/requirements.in b/server/requirements/requirements.in similarity index 100% rename from requirements/requirements.in rename to server/requirements/requirements.in diff --git a/requirements/requirements.txt b/server/requirements/requirements.txt similarity index 100% rename from requirements/requirements.txt rename to server/requirements/requirements.txt diff --git a/setup.cfg b/server/setup.cfg similarity index 100% rename from setup.cfg rename to server/setup.cfg diff --git a/tailwind.config.js b/server/tailwind.config.js similarity index 100% rename from tailwind.config.js rename to server/tailwind.config.js diff --git a/vbv_lernwelt/__init__.py b/server/vbv_lernwelt/__init__.py similarity index 100% rename from vbv_lernwelt/__init__.py rename to server/vbv_lernwelt/__init__.py diff --git a/vbv_lernwelt/conftest.py b/server/vbv_lernwelt/conftest.py similarity index 100% rename from vbv_lernwelt/conftest.py rename to server/vbv_lernwelt/conftest.py diff --git a/vbv_lernwelt/contrib/__init__.py b/server/vbv_lernwelt/contrib/__init__.py similarity index 100% rename from vbv_lernwelt/contrib/__init__.py rename to server/vbv_lernwelt/contrib/__init__.py diff --git a/vbv_lernwelt/contrib/sites/__init__.py b/server/vbv_lernwelt/contrib/sites/__init__.py similarity index 100% rename from vbv_lernwelt/contrib/sites/__init__.py rename to server/vbv_lernwelt/contrib/sites/__init__.py diff --git a/vbv_lernwelt/contrib/sites/migrations/0001_initial.py b/server/vbv_lernwelt/contrib/sites/migrations/0001_initial.py similarity index 100% rename from vbv_lernwelt/contrib/sites/migrations/0001_initial.py rename to server/vbv_lernwelt/contrib/sites/migrations/0001_initial.py diff --git a/vbv_lernwelt/contrib/sites/migrations/0002_alter_domain_unique.py b/server/vbv_lernwelt/contrib/sites/migrations/0002_alter_domain_unique.py similarity index 100% rename from vbv_lernwelt/contrib/sites/migrations/0002_alter_domain_unique.py rename to server/vbv_lernwelt/contrib/sites/migrations/0002_alter_domain_unique.py diff --git a/vbv_lernwelt/contrib/sites/migrations/0003_set_site_domain_and_name.py b/server/vbv_lernwelt/contrib/sites/migrations/0003_set_site_domain_and_name.py similarity index 100% rename from vbv_lernwelt/contrib/sites/migrations/0003_set_site_domain_and_name.py rename to server/vbv_lernwelt/contrib/sites/migrations/0003_set_site_domain_and_name.py diff --git a/vbv_lernwelt/contrib/sites/migrations/0004_alter_options_ordering_domain.py b/server/vbv_lernwelt/contrib/sites/migrations/0004_alter_options_ordering_domain.py similarity index 100% rename from vbv_lernwelt/contrib/sites/migrations/0004_alter_options_ordering_domain.py rename to server/vbv_lernwelt/contrib/sites/migrations/0004_alter_options_ordering_domain.py diff --git a/vbv_lernwelt/contrib/sites/migrations/__init__.py b/server/vbv_lernwelt/contrib/sites/migrations/__init__.py similarity index 100% rename from vbv_lernwelt/contrib/sites/migrations/__init__.py rename to server/vbv_lernwelt/contrib/sites/migrations/__init__.py diff --git a/vbv_lernwelt/core/__init__.py b/server/vbv_lernwelt/core/__init__.py similarity index 100% rename from vbv_lernwelt/core/__init__.py rename to server/vbv_lernwelt/core/__init__.py diff --git a/vbv_lernwelt/core/admin.py b/server/vbv_lernwelt/core/admin.py similarity index 100% rename from vbv_lernwelt/core/admin.py rename to server/vbv_lernwelt/core/admin.py diff --git a/vbv_lernwelt/core/apps.py b/server/vbv_lernwelt/core/apps.py similarity index 100% rename from vbv_lernwelt/core/apps.py rename to server/vbv_lernwelt/core/apps.py diff --git a/vbv_lernwelt/core/middleware/__init__.py b/server/vbv_lernwelt/core/middleware/__init__.py similarity index 100% rename from vbv_lernwelt/core/middleware/__init__.py rename to server/vbv_lernwelt/core/middleware/__init__.py diff --git a/vbv_lernwelt/core/middleware/auth.py b/server/vbv_lernwelt/core/middleware/auth.py similarity index 100% rename from vbv_lernwelt/core/middleware/auth.py rename to server/vbv_lernwelt/core/middleware/auth.py diff --git a/vbv_lernwelt/core/middleware/security.py b/server/vbv_lernwelt/core/middleware/security.py similarity index 100% rename from vbv_lernwelt/core/middleware/security.py rename to server/vbv_lernwelt/core/middleware/security.py diff --git a/vbv_lernwelt/core/migrations/0001_initial.py b/server/vbv_lernwelt/core/migrations/0001_initial.py similarity index 100% rename from vbv_lernwelt/core/migrations/0001_initial.py rename to server/vbv_lernwelt/core/migrations/0001_initial.py diff --git a/vbv_lernwelt/core/migrations/0002_create_users.py b/server/vbv_lernwelt/core/migrations/0002_create_users.py similarity index 100% rename from vbv_lernwelt/core/migrations/0002_create_users.py rename to server/vbv_lernwelt/core/migrations/0002_create_users.py diff --git a/vbv_lernwelt/core/migrations/__init__.py b/server/vbv_lernwelt/core/migrations/__init__.py similarity index 100% rename from vbv_lernwelt/core/migrations/__init__.py rename to server/vbv_lernwelt/core/migrations/__init__.py diff --git a/vbv_lernwelt/core/models.py b/server/vbv_lernwelt/core/models.py similarity index 100% rename from vbv_lernwelt/core/models.py rename to server/vbv_lernwelt/core/models.py diff --git a/vbv_lernwelt/core/templates/core/login.html b/server/vbv_lernwelt/core/templates/core/login.html similarity index 100% rename from vbv_lernwelt/core/templates/core/login.html rename to server/vbv_lernwelt/core/templates/core/login.html diff --git a/vbv_lernwelt/core/tests.py b/server/vbv_lernwelt/core/tests.py similarity index 100% rename from vbv_lernwelt/core/tests.py rename to server/vbv_lernwelt/core/tests.py diff --git a/vbv_lernwelt/core/views.py b/server/vbv_lernwelt/core/views.py similarity index 100% rename from vbv_lernwelt/core/views.py rename to server/vbv_lernwelt/core/views.py diff --git a/vbv_lernwelt/static/fonts/.gitkeep b/server/vbv_lernwelt/static/fonts/.gitkeep similarity index 100% rename from vbv_lernwelt/static/fonts/.gitkeep rename to server/vbv_lernwelt/static/fonts/.gitkeep diff --git a/vbv_lernwelt/static/images/favicons/favicon.ico b/server/vbv_lernwelt/static/images/favicons/favicon.ico similarity index 100% rename from vbv_lernwelt/static/images/favicons/favicon.ico rename to server/vbv_lernwelt/static/images/favicons/favicon.ico diff --git a/vbv_lernwelt/static/js/project.js b/server/vbv_lernwelt/static/js/project.js similarity index 100% rename from vbv_lernwelt/static/js/project.js rename to server/vbv_lernwelt/static/js/project.js diff --git a/vbv_lernwelt/static/sass/project.scss b/server/vbv_lernwelt/static/sass/project.scss similarity index 100% rename from vbv_lernwelt/static/sass/project.scss rename to server/vbv_lernwelt/static/sass/project.scss diff --git a/vbv_lernwelt/static/tailwind/input.css b/server/vbv_lernwelt/static/tailwind/input.css similarity index 100% rename from vbv_lernwelt/static/tailwind/input.css rename to server/vbv_lernwelt/static/tailwind/input.css diff --git a/vbv_lernwelt/templates/403.html b/server/vbv_lernwelt/templates/403.html similarity index 100% rename from vbv_lernwelt/templates/403.html rename to server/vbv_lernwelt/templates/403.html diff --git a/vbv_lernwelt/templates/404.html b/server/vbv_lernwelt/templates/404.html similarity index 100% rename from vbv_lernwelt/templates/404.html rename to server/vbv_lernwelt/templates/404.html diff --git a/vbv_lernwelt/templates/500.html b/server/vbv_lernwelt/templates/500.html similarity index 100% rename from vbv_lernwelt/templates/500.html rename to server/vbv_lernwelt/templates/500.html diff --git a/vbv_lernwelt/templates/base.html b/server/vbv_lernwelt/templates/base.html similarity index 100% rename from vbv_lernwelt/templates/base.html rename to server/vbv_lernwelt/templates/base.html diff --git a/vbv_lernwelt/templates/pages/about.html b/server/vbv_lernwelt/templates/pages/about.html similarity index 100% rename from vbv_lernwelt/templates/pages/about.html rename to server/vbv_lernwelt/templates/pages/about.html diff --git a/vbv_lernwelt/templates/pages/home.html b/server/vbv_lernwelt/templates/pages/home.html similarity index 100% rename from vbv_lernwelt/templates/pages/home.html rename to server/vbv_lernwelt/templates/pages/home.html diff --git a/vbv_lernwelt/utils/__init__.py b/server/vbv_lernwelt/utils/__init__.py similarity index 100% rename from vbv_lernwelt/utils/__init__.py rename to server/vbv_lernwelt/utils/__init__.py