From d274eeef49858300fe1d05e56ed60dd598b3ca09 Mon Sep 17 00:00:00 2001
From: jackie / Andrea Ida Malkah Klaura <jackie@diebin.at>
Date: Sat, 10 Apr 2021 09:56:47 +0200
Subject: [PATCH] adapt README to current setup

---
 README.rst | 94 +++++++++++++++++++-----------------------------------
 1 file changed, 32 insertions(+), 62 deletions(-)

diff --git a/README.rst b/README.rst
index bf24008c..2c6a229c 100644
--- a/README.rst
+++ b/README.rst
@@ -5,28 +5,32 @@ AURA Steering: Program Scheduler
 Installation
 ------------
 
-If you have a working Docker environment, do::
+If you want to have quick dev server and already have the *steering-postgres*
+container of the *aura-web* repository running, follow the steps outlined in the
+*Setting up the configuration* section and do::
 
-    $ docker build -t pv_container .
-    $ docker run -p 8000:8000 -d pv_container:latest
+    $ docker build -t steering-django --target dev .
+    $ docker run --rm -v $(pwd):/aura --network auraweb_auranet steering-django:latest python manage.py migrate
+    $ docker run -it --rm -v $(pwd):/aura --network auraweb_auranet steering-django:latest python manage.py createsuperuser
+    $ docker run --rm -p 8000:8000 -v $(pwd):/aura --network auraweb_auranet steering-django:latest
 
-and log into it at http://127.0.0.1:8000/admin/ with username "admin" and password "admin". Full setup without Docker is done as described below.
+and log into it at http://127.0.0.1:8000/admin/ with the credentials you have
+set in the ``createsuperuser`` step. Once this is done, every other time you
+want to start a *steering-django* container, you will only have to use the
+last command.
+
+**Full setup without Docker** is done as described below.
 
 To get setup you must have the following installed:
 
-* PostgresSQL or MySQL client development libraries
+* PostgresSQL (except you are using the aura-web docker container *steering-postgres* for it)
 * JPEG library development files
 * Python 3.8 or later including development files
 
-In Debian or Ubuntu (or derivatives) you should be able to achieve this with this command:
-
-* Using PostgreSQL::
+In Debian or Ubuntu (or derivatives) you should be able to achieve this with this command::
 
     $ sudo apt-get install postgresql postgresql-contrib libjpeg-dev python3 python3-dev
 
-* Using MySQL::
-
-    $ sudo apt-get install libmysqlclient-dev libjpeg-dev python3 python3-dev
 
 Setting up the environment
 --------------------------
@@ -44,57 +48,21 @@ Change into the base directory of this software and install the project dependen
 Setting up the configuration
 ----------------------------
 
-By default the project is set up to run on a SQLite database.
-
-Create a file ``pv/local_settings.py`` and add at least the following line::
-
-    SECRET_KEY = 'secret key'
-
-(obviously replacing "secret key" with a key of your choice).
-
-Setting up PostgreSQL
----------------------
-
-We recommend using PostgreSQL in order to be able to use the collation utf8mb64_unicode_ci and thus being able to display all languages.
-
-To use PostgreSQL, add the following to your ``local_settings.py`` (before migrating) and add your credentials::
-
-    DATABASES = {
-        'default': {
-            'ENGINE': 'django.db.backends.postgresql',
-            'NAME': '',
-            'USER': '',
-            'PASSWORD': '',
-            'HOST': 'localhost',
-            'PORT': '5432'
-        }
-    }
-
-Setting up MySQL
-----------------
-
-**Note:** When adding your database, make sure you **don't** use the collation utf8mb4_unicode_ci or you will get a key length error during migration. (use e.g. utf8_general_ci instead).
-
-To use MySQL, add the following to your ``local_settings.py`` (before migrating)::
-
-    DATABASES = {
-        'default': {
-            'ENGINE': 'django.db.backends.mysql',
-            'OPTIONS': {
-                'read_default_file': os.path.join(PROJECT_DIR, 'mysql.cnf'),
-            },
-        }
-    }
+Copy the ``.env.example`` file to ``.env`` and change the values accordingly.
+You have to at least provide the ``SECRET_KEY`` and the ``DBPASS`` values
+for Django to start. The file provides extensive comments on all the settings.
+For a developments environment the defaults should be just fine if you use the
+*steering-postgres* docker container from the *aura-web* repository. If you
+want to create your own database on you local machine, you will have to use
+*steering* as the database and user name, or adopt the ``DB*`` values
+accordingly.
 
-Create a file ``pv/mysql.cnf`` and give your MySQL credentials::
+Also be aware that there is a ``RUN_IN_DOCKER`` setting that is ``True`` by
+default. This should be fine for a production environment where Django is
+run inside a container. If you follow these steps here to create your own
+development environment you have to set this setting to ``False``. You also
+might want to set ``DEBUG`` to ``True`` for your development environment.
 
-    [client]
-    database =
-    host = localhost
-    port = 3306
-    user =
-    password =
-    default-character-set = utf8
 
 Setting up the database
 -----------------------
@@ -119,6 +87,8 @@ In development you should run::
     (python)$ python manage.py runserver
 
 
-After this you can open http://127.0.0.1:8000/admin in your browser and log in with username "admin" and password "admin".
+After this you can open http://127.0.0.1:8000/admin in your browser and log in
+with the credentials you have chosen in the ``createsuperuser`` command.
 
-Make sure to change your password by visiting http://127.0.0.1:8000/admin/auth/user/1/password/
+If you are using some placeholder credentials, make sure to change your password
+by visiting http://127.0.0.1:8000/admin/auth/user/1/password/
-- 
GitLab