def test_my_custom_param(self): self.assertEqual('Hello World!', settings('MY_CUSTOM_PARAM'))
def home(): logger.info("Start {{cookiecutter.project_name}}") return "{{cookiecutter.project_name}} home: " + settings('MY_CUSTOM_PARAM')
def main(): logger.info("Start {{cookiecutter.project_name}}") docopt(__doc__) set_settings_module() logger.info("MY_CUSTOM_PARAM: %s" % settings('MY_CUSTOM_PARAM'))
""" Define the logger """ import logging from environ import settings # create logger logger = logging.getLogger('{{cookiecutter.repo_name}}') logger.setLevel(logging.INFO) # create console handler and set level to debug ch = logging.StreamHandler() ch.setLevel(logging.INFO) # file handler fh = logging.FileHandler(settings('LOG_FILE')) fh.setLevel(logging.INFO) # create formatter formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - \ %(message)s') # add formatter ch.setFormatter(formatter) fh.setFormatter(formatter) # add handlers to logger logger.addHandler(ch) logger.addHandler(fh)