Skip to content

Instantly share code, notes, and snippets.

@FBosler
Created October 11, 2019 18:23
Show Gist options
  • Save FBosler/c001ed47cfcdd6b05a213d392c6d285f to your computer and use it in GitHub Desktop.
Save FBosler/c001ed47cfcdd6b05a213d392c6d285f to your computer and use it in GitHub Desktop.
import os
import yaml as _yaml
import logging
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def get_config():
config_path = os.path.join(os.path.dirname(__file__), '..', 'config', 'production.yml')
try:
with open(config_path) as config_file:
return _yaml.load(config_file)
except FileNotFoundError:
logger.error(f'You probably forgot to create a production.yml, as we could not find {config_path}')
raise
def get_post_data():
data_path = os.path.join(os.path.dirname(__file__), '..', 'config', 'post_data.yml')
with open(data_path) as config_file:
return _yaml.load(config_file)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment