Browse Source

Adaption to new logging

master
Dirk Alders 3 years ago
parent
commit
176794a3fc
7 changed files with 22 additions and 45 deletions
  1. 2
    0
      .gitignore
  2. 1
    2
      README.md
  3. 16
    23
      main/settings.py
  4. 1
    1
      mycreole
  5. 1
    1
      patt
  6. 0
    17
      readme.txt
  7. 1
    1
      users

+ 2
- 0
.gitignore View File

1
 config.py
1
 config.py
2
 data/
2
 data/
3
+
3
 venv
4
 venv
5
+.settings
4
 
6
 
5
 # ---> Python
7
 # ---> Python
6
 # Byte-compiled / optimized / DLL files
8
 # Byte-compiled / optimized / DLL files

+ 1
- 2
README.md View File

87
     python manage.py dumpdata --natural-foreign --natural-primary -e contenttypes -e sessions -e auth.Permission -e sessions patt --indent 2 > dump_patt.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
88
     tar -cvzf dump_media.tgz data/media
89
 
89
 
90
-**Further Files need to be backuped! **
91
 
90
 
92
 ### Restore Backup
91
 ### Restore Backup
93
 
92
 
94
     source venv/bin/activate
93
     source venv/bin/activate
95
 
94
 
96
-If you are starting with any database, you need to create one
95
+If you are starting without a database, you need to create one
97
 
96
 
98
     python manage.py migrate
97
     python manage.py migrate
99
 
98
 

+ 16
- 23
main/settings.py View File

11
 """
11
 """
12
 
12
 
13
 import config
13
 import config
14
+from logging.handlers import SocketHandler as _SocketHandler
14
 import os
15
 import os
15
 import stat
16
 import stat
16
 import sys
17
 import sys
194
 
195
 
195
 # Logging Configuration
196
 # Logging Configuration
196
 #
197
 #
197
-debug_handler = 'console'
198
-default_handler = [debug_handler] if DEBUG else ['console']
198
+class DjangoSocketHandler(_SocketHandler):
199
+    def emit(self, record):
200
+        if hasattr(record, 'request'):
201
+            record.request = None
202
+        return super().emit(record)
203
+
204
+
205
+default_handler = ['socket'] if DEBUG else ['console']
199
 #
206
 #
200
 LOGGING = {
207
 LOGGING = {
201
     'version': 1,
208
     'version': 1,
218
             'class': 'logging.StreamHandler',
225
             'class': 'logging.StreamHandler',
219
             'formatter': 'short',
226
             'formatter': 'short',
220
         },
227
         },
221
-        'console_long': {
228
+        'socket': {
222
             'level': 'DEBUG',
229
             'level': 'DEBUG',
223
-            'class': 'logging.StreamHandler',
224
-            'formatter': 'long',
230
+            'class': 'main.settings.DjangoSocketHandler',
231
+            'host': '127.0.0.1',
232
+            'port': 19996,
225
         },
233
         },
226
     },
234
     },
227
     'loggers': {
235
     'loggers': {
228
-        'AUTH': {
229
-            'handlers': default_handler,
230
-            'level': 'INFO',
231
-            'propagate': False,
232
-        },
233
-        'ACC': {
234
-            'handlers': default_handler,
235
-            'level': 'INFO',
236
-            'propagate': False,
237
-        },
238
-        'APP': {
239
-            'handlers': default_handler,
240
-            'level': 'INFO',
241
-            'propagate': False,
242
-        },
243
-        'WHOOSH': {
236
+        'django': {
244
             'handlers': default_handler,
237
             'handlers': default_handler,
245
             'level': 'INFO',
238
             'level': 'INFO',
246
             'propagate': False,
239
             'propagate': False,
247
         },
240
         },
248
-        'FSTOOLS': {
241
+        config.APP_NAME: {
249
             'handlers': default_handler,
242
             'handlers': default_handler,
250
-            'level': 'INFO',
243
+            'level': 'DEBUG' if DEBUG else 'INFO',
251
             'propagate': False,
244
             'propagate': False,
252
         },
245
         },
253
     },
246
     },

+ 1
- 1
mycreole

1
-Subproject commit dd0edc2d56c2c234be32fa76e3bd5b6b4f38a69f
1
+Subproject commit 5f30383c83b0ea94341b999c489a34f2e7d57f80

+ 1
- 1
patt

1
-Subproject commit 63e9af4d65a486309e55bb0925866fb1eaec99cb
1
+Subproject commit be03b653ebce2dadb5bfb314e597966751fb9cf7

+ 0
- 17
readme.txt View File

1
-1. Setupt venev
2
-  * virtualenv -p /usr/bin/python3 patt-venv
3
-  * ln -s patt-venv/bin/activate
4
-  * source activate
5
-  * Sometimes upgrades are needed: pip list --outdated | cut -d ' ' -f 1 | xargs pip install $1 --upgrade
6
-  * pip install -r requirements.txt
7
-2. Set SECRET:KEY in config.py
8
-3. python manage.py migrate
9
-4. python manage.py createsuperuser
10
-5. python manage.py collectstatic
11
-6. chgrp www-data . && chmod 770 .
12
-7. chgrp www-data db.sqlite3 && chmod 664 db.sqlite3
13
-8. chgrp www-data -R data
14
-8.1. find data -type d -exec chmod 775 "{}" \;
15
-8.2. find data -type f -exec chmod 664 "{}" \;
16
-
17
-x. Run server by command "python manage.py runserver 0.0.0.0:8000" or add App to apache

+ 1
- 1
users

1
-Subproject commit 8cf64464ba094df60fe81442dd0d728075368344
1
+Subproject commit 0827a5311fdbbef689365c6db5762881e048ba9c

Loading…
Cancel
Save