-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add: custom config & gunicorn config update
- Loading branch information
Showing
9 changed files
with
73 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
data/ | ||
config/custom_config_local.py | ||
|
||
.vscode/ | ||
.idea/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# NOTE: | ||
# You can duplicate this file as custom_config_local.py in this folder, the application will try to load config in | ||
# custom_config_local.py before custom_config.py. | ||
# | ||
# All paths below are relative to the project folder (which is where run.py at) | ||
# Absolute paths also supported. e.g. /var/log/ | ||
|
||
# WORKERS: The number of worker processes for handling requests. | ||
WORKERS: int = 4 | ||
|
||
# LOG_PATH: Where log file stores in. Default is ./data/logs | ||
LOG_PATH: str = r'./data/logs' | ||
|
||
# LOG_FILENAME: The log file's filename. | ||
LOG_FILENAME: str = 'app.log' | ||
|
||
# REDIS_URL: The URL to connect to a Redis server. | ||
# If empty, a filesystem cache will be used under ./data/cache | ||
REDIS_URL: str = 'redis://localhost:6379/0' | ||
|
||
# SVG_OPTIMIZE_ENABLE: Whether or not to optimize SVGs with SVGO before response. | ||
# npm and SVGO is needed to be installed. | ||
SVG_OPTIMIZE_ENABLE: bool = False | ||
|
||
# SVGO_PATH: Specifies the path to SVGO. | ||
SVGO_PATH: str = r'/usr/bin/svgo' | ||
|
||
# SVGO_CONFIG_PATH: Specifies the path to the config file of SVGO. | ||
SVGO_CONFIG_PATH: str = r'./config/svgo.yml' |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,21 @@ | ||
# -*- coding: utf-8 -*- | ||
import os | ||
from pathlib import Path | ||
|
||
os.makedirs('data/logs', exist_ok=True) | ||
try: | ||
import config.custom_config_local as custom_config | ||
except ImportError as err: | ||
import config.custom_config as custom_config | ||
|
||
workers = 4 | ||
threads = 2 | ||
os.makedirs(custom_config.LOG_PATH, exist_ok=True) | ||
|
||
workers = custom_config.WORKERS | ||
worker_class = 'gevent' | ||
bind = '127.0.0.1:2012' | ||
daemon = True | ||
worker_connections = 100 | ||
accesslog = './data/logs/gunicorn_app_access.log' | ||
errorlog = './data/logs/gunicorn_app_error.log' | ||
loglevel = 'warning' | ||
accesslog = str(Path(custom_config.LOG_PATH, 'gunicorn_access.log').resolve()) | ||
errorlog = str(Path(custom_config.LOG_PATH, 'gunicorn.log').resolve()) | ||
loglevel = 'info' | ||
reload = True | ||
timeout = 60 | ||
access_log_format = '%(t)s %(l)s %({X-Real-IP}i)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters