From 5677eb5c486f01b91bb9eb9afd3abb23aeae9df5 Mon Sep 17 00:00:00 2001 From: Marion Date: Thu, 15 Feb 2024 10:27:23 +0100 Subject: [PATCH] Getting started: - update the readme - add DB init script --- README.md | 30 +++++++++++++++++++++++- db/docker_db/init-scripts/01_init_db.sql | 15 ++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 db/docker_db/init-scripts/01_init_db.sql diff --git a/README.md b/README.md index ed8cd7d0..f968bf7b 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,34 @@ WITH unaccent, simple; Now that the database is ready, you can start backend either with Docker or not. +### Run dev server without docker on a Linux based machine + +- Create a virtual python environment and install the requirements.txt + +- run the migrations on the DB and collectstatic: + + ``` + python manage.py migrate + python manage.py collectstatic + ``` + +- Create admin account and Extract group with permissions + ``` + python manage.py fixturize + ``` + +- Create a super user: + ``` + python manage.py createsuperuser + ``` + +- Run the application: + ``` + python3 manage.py runserver + ``` + +Access the application under the indicated address + ### Run dev server without docker on Windows You'll need to configure 3 paths to your GDAL installation according to `.env.sample`. @@ -57,7 +85,7 @@ Then, we're going to: * Run migrations * Collect static files for the admin interface - * Generate translations for your langage + * Generate translations for your language * Add minimal users to database ```shell diff --git a/db/docker_db/init-scripts/01_init_db.sql b/db/docker_db/init-scripts/01_init_db.sql new file mode 100644 index 00000000..261b281c --- /dev/null +++ b/db/docker_db/init-scripts/01_init_db.sql @@ -0,0 +1,15 @@ +-- CREATE ROLE geoshop WITH LOGIN PASSWORD geoshop; +-- +-- CREATE DATABASE geoshop OWNER geoshop; +-- REVOKE ALL ON DATABASE geoshop FROM PUBLIC; + +CREATE EXTENSION postgis; +CREATE EXTENSION unaccent; +CREATE EXTENSION "uuid-ossp"; + +CREATE SCHEMA geoshop AUTHORIZATION geoshop; + +CREATE TEXT SEARCH CONFIGURATION fr (COPY = simple); + +ALTER TEXT SEARCH CONFIGURATION fr ALTER MAPPING FOR hword, hword_part, word +WITH unaccent, simple; \ No newline at end of file