Quellcode durchsuchen

README instructions improved

master
Dirk Alders vor 3 Jahren
Ursprung
Commit
94fb13fb65
3 geänderte Dateien mit 116 neuen und 16 gelöschten Zeilen
  1. 103
    2
      README.md
  2. 10
    8
      config_example/config.py
  3. 3
    6
      main/settings.py

+ 103
- 2
README.md Datei anzeigen

@@ -1,3 +1,104 @@
1
-# patt
1
+# PaTT
2 2
 
3
-Project And Teamorganisation Tool
3
+Project and Teamorganisation Tool
4
+
5
+
6
+----
7
+## Installation
8
+----
9
+### Get the repository
10
+####Go to the subfolder, where you want to create your new PaTT-Application (here ~/tmp)
11
+    cd ~/tmp
12
+#### Clone the repository
13
+    git clone https://git.mount-mockery.de/application/patt.git
14
+#### Change to your repository and initialise it completely
15
+    cd patt
16
+    git submodule init
17
+    git submodule update
18
+
19
+
20
+### Create your virtual environment
21
+#### Create python3 environment
22
+    virtualenv -p /usr/bin/python3 venv
23
+#### Activate the environment
24
+    source activate
25
+#### Upgrade all outdated packages
26
+    pip list -o --format freeze|cut -d '=' -f 1 | xargs pip install $1 --upgrade
27
+#### Install PaTT Requirements
28
+    pip install -r requirements.txt
29
+
30
+----
31
+## Configuration and Initialisation of PaTT
32
+----
33
+### Create your config File
34
+#### Copy the config example
35
+    cp config_example/config.py .
36
+    chmod 700 config.py
37
+
38
+#### Set a secret key
39
+Edit config.py and add a SECRET_KEY. Generate the secret e.g by executing the following command:
40
+
41
+    python manage.py
42
+
43
+At the End of the error message you'll see a random secret:
44
+
45
+KeyError: "You need to create a config.py file including at least a SECRET_KEY definition (e.g.: --> **'HERE IS THE RANDOM SECRET ;-)'** <--)."
46
+
47
+
48
+
49
+### Create your initial database and first user for Patt
50
+    python manage.py migrate
51
+    python manage.py createsuperuser
52
+
53
+### Finalise Configuration
54
+Now there are two ways to finalise your configuration. The first way is for a test or development system. The other is for a production System.
55
+
56
+1. **Test or development System:** Edit
57
+    config.py
58
+and set the Variable
59
+    DEBUG
60
+to
61
+    True.
62
+
63
+2. **Production System:** Edit
64
+    config.py
65
+and set the Variable ALLOWED_HOSTS. Execute
66
+    "python manage.py collectstatic" to create a folder including all static files. Then add PaTT to your server configuration. See also [Django Documnetation](https://docs.djangoproject.com/en/3.1/howto/deployment/) for further information.
67
+
68
+----
69
+## Start the Test or development System
70
+----
71
+### Go to the folder, where your PaTT-Application is locates (here ~/tmp/patt)
72
+    cd ~/tmp/patt
73
+
74
+###Activate your Virtual Environment
75
+    source activate
76
+
77
+###Start the Server
78
+    python manage.py runserver
79
+
80
+
81
+----
82
+## Backup
83
+----
84
+### Create Backup files
85
+    source venv/bin/activate
86
+    python manage.py dumpdata --natural-foreign --natural-primary -e contenttypes -e sessions -e auth.Permission -e sessions -e patt --indent 2 > dump_base.json
87
+    python manage.py dumpdata --natural-foreign --natural-primary -e contenttypes -e sessions -e auth.Permission -e sessions patt --indent 2 > dump_patt.json
88
+    tar -cvzf dump_media.tgz data/media
89
+
90
+**Further Files need to be backuped! **
91
+
92
+### Restore Backup
93
+
94
+    source venv/bin/activate
95
+
96
+If you are starting with any database, you need to create one
97
+
98
+    python manage.py migrate
99
+
100
+Afterward add data step by step to the database.
101
+
102
+    python manage.py loaddata dump_base.json
103
+    python manage.py loaddata dump_patt.json
104
+    tar -xvzf dump_media.tgz

+ 10
- 8
config_example/config.py Datei anzeigen

@@ -1,15 +1,17 @@
1
-import os
2
-
3
-BASE_DIR = os.path.dirname(os.path.abspath(__file__))
4
-
5 1
 #
6 2
 # General settings
7 3
 #
8
-# SECRET_KEY = 'define a secret key'
9
-#
10
-# ALLOWED_HOSTS = []
4
+
5
+# SECURITY WARNING: don't run with debug turned on in production!
6
+# DEBUG = False
7
+
8
+# SECURITY WARNING: don't run with a dummy secret in production!
9
+# SECRET_KEY = None
10
+
11
+# SECURITY WARNING: don't run with '0.0.0.0' in in production, unless you know what you are doing!
12
+# ALLOWED_HOSTS = ['127.0.0.1', ]
11 13
 
12 14
 #
13 15
 # Style settings
14 16
 #
15
-# DEFAULT_THEME = 'clear-red'
17
+# DEFAULT_THEME = 'clear-green'

+ 3
- 6
main/settings.py Datei anzeigen

@@ -31,9 +31,10 @@ if sys.platform == 'linux' or sys.platform == 'linux2':
31 31
 # Default values, if not defined in config.py
32 32
 #
33 33
 USER_CONFIG_DEFAULTS = {
34
+    'DEBUG': False,
34 35
     'SECRET_KEY': None,
35 36
     'DEFAULT_THEME': 'clear-green',
36
-    'ALLOWED_HOSTS': [],
37
+    'ALLOWED_HOSTS': ['127.0.0.1', ],
37 38
 }
38 39
 
39 40
 # Set configuration parameters
@@ -54,13 +55,9 @@ for property_name in USER_CONFIG_DEFAULTS:
54 55
 if SECRET_KEY is None:
55 56
     chars = 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'
56 57
     s_key = ''.join([random.choice(chars) for n in range(50)])
57
-    secret_key_warning = "You need to create a config.py file including a variable config which is a dict  with at least a SECRET_KEY definition (e.g.: %s)." % repr(s_key)
58
+    secret_key_warning = "You need to create a config.py file including at least a SECRET_KEY definition (e.g.: --> %s <--)." % repr(s_key)
58 59
     raise KeyError(secret_key_warning)
59 60
 
60
-# SECURITY WARNING: don't run with debug turned on in production!
61
-#
62
-DEBUG = False
63
-
64 61
 
65 62
 # Application definition
66 63
 #

Laden…
Abbrechen
Speichern