浏览代码

README instructions improved

master
Dirk Alders 3 年前
父节点
当前提交
0e7664e059
共有 3 个文件被更改,包括 111 次插入11 次删除
  1. 92
    2
      README.md
  2. 16
    3
      config_example/config.py
  3. 3
    6
      main/settings.py

+ 92
- 2
README.md 查看文件

@@ -1,3 +1,93 @@
1
-# pygal
1
+# PyGal
2 2
 
3
-Python Galery
3
+Python Galery
4
+
5
+----
6
+## Installation
7
+----
8
+### Get the repository
9
+####Go to the subfolder, where you want to create your new PaTT-Application (here ~/tmp)
10
+    cd ~/tmp
11
+#### Clone the repository
12
+    git clone https://git.mount-mockery.de/application/pygal.git
13
+#### Change to your repository and initialise it completely
14
+    cd pygal
15
+    git submodule init
16
+    git submodule update
17
+
18
+
19
+### Create your virtual environment
20
+#### Create python3 environment
21
+    virtualenv -p /usr/bin/python3 venv
22
+#### Activate the environment
23
+    source activate
24
+#### Upgrade all outdated packages
25
+    pip list -o --format freeze|cut -d '=' -f 1 | xargs pip install $1 --upgrade
26
+#### Install PaTT Requirements
27
+    pip install -r requirements.txt
28
+
29
+----
30
+## Configuration and Initialisation of PyGal
31
+----
32
+### Create your config File
33
+#### Copy the config example
34
+    cp config_example/config.py .
35
+    chmod 700 config.py
36
+
37
+#### Set a secret key
38
+Edit config.py and add a SECRET_KEY. Generate the secret e.g by executing the following command:
39
+
40
+    python manage.py
41
+
42
+At the End of the error message you'll see a random secret:
43
+
44
+KeyError: "You need to create a config.py file including at least a SECRET_KEY definition (e.g.: --> **'HERE IS THE RANDOM SECRET ;-)'** <--)."
45
+
46
+
47
+### Create your initial database and first user for PyGal
48
+    python manage.py migrate
49
+    python manage.py createsuperuser
50
+
51
+### Finalise Configuration
52
+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.
53
+
54
+1. **Test or development System:** Edit
55
+    config.py
56
+and set the Variable
57
+    DEBUG
58
+to
59
+    True.
60
+
61
+2. **Production System:** Edit
62
+    config.py
63
+and set the Variable ALLOWED_HOSTS. Execute
64
+    "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.
65
+
66
+----
67
+## Start the Test or development System
68
+----
69
+### Go to the folder, where your PyGal-Application is locates (here ~/tmp/pygal)
70
+    cd ~/tmp/pygal
71
+
72
+###Activate your Virtual Environment
73
+    source activate
74
+
75
+###Start the Server
76
+    python manage.py runserver
77
+
78
+
79
+[comment]: <> (----)
80
+[comment]: <> (## Backup))
81
+[comment]: <> (----)
82
+[comment]: <> (### Create Backup files)
83
+
84
+
85
+[comment]: <> (### Restore Backup)
86
+
87
+[comment]: <> (    source venv/bin/activate)
88
+
89
+[comment]: <> (If you are starting without a database, you need to create one)
90
+
91
+[comment]: <> (    python manage.py migrate)
92
+
93
+[comment]: <> (Afterward add data...)

+ 16
- 3
config_example/config.py 查看文件

@@ -5,19 +5,30 @@ BASE_DIR = os.path.dirname(os.path.abspath(__file__))
5 5
 #
6 6
 # General settings
7 7
 #
8
+
9
+# SECURITY WARNING: don't run with debug turned on in production!
10
+# DEBUG = False
11
+
12
+# SECURITY WARNING: don't run with a dummy secret in production!
8 13
 # SECRET_KEY = 'define a secret key'
14
+
15
+# SECURITY WARNING: don't run with '0.0.0.0' in in production, unless you know what you are doing!
16
+# ALLOWED_HOSTS = ['127.0.0.1', ]
17
+
9 18
 #
10 19
 # ITEM_ROOT = os.path.join(BASE_DIR, 'data', 'example_data')
11
-# ALLOWED_HOSTS = []
12 20
 
13 21
 #
14 22
 # Access Right settings
15 23
 #
16
-# SUSPEND_PUBLIC = True        # Set this to True to ensure, that unauthenticated users have no permission
24
+
25
+# Set this to True to ensure, that unauthenticated users have no permission
26
+# SUSPEND_PUBLIC = True
17 27
 
18 28
 #
19 29
 # Style settings
20 30
 #
31
+
21 32
 # DEFAULT_THEME = 'clear-red'
22 33
 # THUMBNAIL_SIZES = [137, 175, 250]
23 34
 # WEBNAIL_SIZES = [450, 1100, 1750]
@@ -25,7 +36,9 @@ BASE_DIR = os.path.dirname(os.path.abspath(__file__))
25 36
 #
26 37
 # Content settings
27 38
 #
28
-# SORT_BY_DATE = True          # Sorting by name if False
39
+
40
+# Sorting by name if False
41
+# SORT_BY_DATE = True
29 42
 # SHOW_IMAGE = True
30 43
 # SHOW_VIDEO = True
31 44
 # SHOW_AUDIO = False

+ 3
- 6
main/settings.py 查看文件

@@ -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,
36
+    'ALLOWED_HOSTS': ['127.0.0.1', ],
35 37
     'DEFAULT_THEME': 'clear-red',
36
-    'ALLOWED_HOSTS': [],
37 38
     'ITEM_ROOT': os.path.join(BASE_DIR, 'data', 'example_data'),
38 39
     'THUMBNAIL_SIZES': [137, 175, 250],
39 40
     'WEBNAIL_SIZES': [450, 1100, 1750],
@@ -63,13 +64,9 @@ for property_name in USER_CONFIG_DEFAULTS:
63 64
 if SECRET_KEY is None:
64 65
     chars = 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'
65 66
     s_key = ''.join([random.choice(chars) for n in range(50)])
66
-    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)
67
+    secret_key_warning = "You need to create a config.py file including at least a SECRET_KEY definition (e.g.: %s)." % repr(s_key)
67 68
     raise KeyError(secret_key_warning)
68 69
 
69
-# SECURITY WARNING: don't run with debug turned on in production!
70
-#
71
-DEBUG = False
72
-
73 70
 
74 71
 # Application definition
75 72
 #

正在加载...
取消
保存