-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathconfig.py
More file actions
60 lines (48 loc) · 1.23 KB
/
config.py
File metadata and controls
60 lines (48 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
"""
Configuration settings.
"""
import os
import logging.config
HOST = '0.0.0.0'
PORT = 5555
PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
STATIC_FILES_DIR = os.path.join(PROJECT_DIR, 'static_files')
SOCKET_BACKLOG_SIZE = 5
FILE_CHUNK_SIZE = 1024 * 1024
RECV_BUFSIZ = 1024
THREAD_POOL_SIZE = 10
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format': '%(asctime)s %(module)s %(process)d %(thread)d %(levelname)s %(message)s'
},
'simple': {
'format': '%(levelname)s %(message)s'
},
},
'handlers': {
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'verbose'
},
'file-log': {
'level': 'DEBUG',
'class': 'logging.handlers.TimedRotatingFileHandler',
'formatter': 'verbose',
'filename': 'run.log',
'when': 'midnight',
},
},
'loggers': {
'simpleHttpServer': {
'handlers': ['file-log', 'console'],
'propagate': False,
'level': 'INFO',
},
},
}
def setup_logging():
logging.config.dictConfig(LOGGING)