I'm trying to load a settings file from a parent directory in Python 3.5 like so:
# src/data/get_raw_data.py
import sys
import os
sys.path.append('../')
from settings import config
The settings file looks like this:
# src/settings.py
from os.path import join, dirname, os
from dotenv import load_dotenv
dotenv_path = join(dirname(__file__), '../.env')
load_dotenv(dotenv_path)
class ParamConfig:
"""Config variables for the project"""
def __init__(self):
self.kaggle_username = os.environ.get("KAGGLE_USERNAME")
self.kaggle_password = os.environ.get("KAGGLE_PASSWORD")
config = ParamConfig()
I'm getting an import error when i try to run the file using this in my console: python src/data/get_raw_data.py
Its telling me that it cannot find a module with name settings. Why can't i find the settings module? How should i do this import?