Adaption to new logging

This commit is contained in:
Dirk Alders 2021-01-21 18:58:24 +01:00
parent 94fb13fb65
commit 176794a3fc
7 changed files with 22 additions and 45 deletions

2
.gitignore vendored
View File

@ -1,6 +1,8 @@
config.py
data/
venv
.settings
# ---> Python
# Byte-compiled / optimized / DLL files

View File

@ -87,13 +87,12 @@ and set the Variable ALLOWED_HOSTS. Execute
python manage.py dumpdata --natural-foreign --natural-primary -e contenttypes -e sessions -e auth.Permission -e sessions patt --indent 2 > dump_patt.json
tar -cvzf dump_media.tgz data/media
**Further Files need to be backuped! **
### Restore Backup
source venv/bin/activate
If you are starting with any database, you need to create one
If you are starting without a database, you need to create one
python manage.py migrate

View File

@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/3.0/ref/settings/
"""
import config
from logging.handlers import SocketHandler as _SocketHandler
import os
import stat
import sys
@ -194,8 +195,14 @@ PERSISTENT_SESSION_VARIABLES = []
# Logging Configuration
#
debug_handler = 'console'
default_handler = [debug_handler] if DEBUG else ['console']
class DjangoSocketHandler(_SocketHandler):
def emit(self, record):
if hasattr(record, 'request'):
record.request = None
return super().emit(record)
default_handler = ['socket'] if DEBUG else ['console']
#
LOGGING = {
'version': 1,
@ -218,36 +225,22 @@ File "%(pathname)s", line %(lineno)d, in %(funcName)s
'class': 'logging.StreamHandler',
'formatter': 'short',
},
'console_long': {
'socket': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'long',
'class': 'main.settings.DjangoSocketHandler',
'host': '127.0.0.1',
'port': 19996,
},
},
'loggers': {
'AUTH': {
'django': {
'handlers': default_handler,
'level': 'INFO',
'propagate': False,
},
'ACC': {
config.APP_NAME: {
'handlers': default_handler,
'level': 'INFO',
'propagate': False,
},
'APP': {
'handlers': default_handler,
'level': 'INFO',
'propagate': False,
},
'WHOOSH': {
'handlers': default_handler,
'level': 'INFO',
'propagate': False,
},
'FSTOOLS': {
'handlers': default_handler,
'level': 'INFO',
'level': 'DEBUG' if DEBUG else 'INFO',
'propagate': False,
},
},

@ -1 +1 @@
Subproject commit dd0edc2d56c2c234be32fa76e3bd5b6b4f38a69f
Subproject commit 5f30383c83b0ea94341b999c489a34f2e7d57f80

2
patt

@ -1 +1 @@
Subproject commit 63e9af4d65a486309e55bb0925866fb1eaec99cb
Subproject commit be03b653ebce2dadb5bfb314e597966751fb9cf7

View File

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

2
users

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