Skip to content

Commit

Permalink
Chapter 17: Traditional hosting (17g)
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrinberg committed Nov 11, 2022
1 parent 3a4fbbd commit f37dbad
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
14 changes: 14 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,26 @@ def init_app(cls, app):
app.logger.addHandler(file_handler)


class UnixConfig(ProductionConfig):
@classmethod
def init_app(cls, app):
ProductionConfig.init_app(app)

# log to syslog
import logging
from logging.handlers import SysLogHandler
syslog_handler = SysLogHandler()
syslog_handler.setLevel(logging.INFO)
app.logger.addHandler(syslog_handler)


config = {
'development': DevelopmentConfig,
'testing': TestingConfig,
'production': ProductionConfig,
'heroku': HerokuConfig,
'docker': DockerConfig,
'unix': UnixConfig,

'default': DevelopmentConfig
}
5 changes: 5 additions & 0 deletions flasky.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import os
from dotenv import load_dotenv

dotenv_path = os.path.join(os.path.dirname(__file__), '.env')
if os.path.exists(dotenv_path):
load_dotenv(dotenv_path)

COV = None
if os.environ.get('FLASK_COVERAGE'):
Expand Down
1 change: 1 addition & 0 deletions requirements/common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Mako==1.0.7
Markdown==2.6.8
MarkupSafe==1.1.1
python-dateutil==2.6.1
python-dotenv==0.6.5
python-editor==1.0.3
six==1.10.0
SQLAlchemy==1.1.11
Expand Down

0 comments on commit f37dbad

Please sign in to comment.