diff --git a/.gitignore b/.gitignore index 3d0a1d2..6513c1c 100644 --- a/.gitignore +++ b/.gitignore @@ -63,4 +63,5 @@ Thumbs.db # Database file # /instance # votes.db # Ignore the votes database file -# *.db \ No newline at end of file +# *.db +src/votes.db diff --git a/src/app.py b/src/app.py index d0207be..8c0e00a 100644 --- a/src/app.py +++ b/src/app.py @@ -9,10 +9,17 @@ from qiskit import QuantumCircuit from qiskit_aer import AerSimulator from qiskit.compiler import transpile +from dotenv import load_dotenv + +# This will load the environment variables from the .env file +load_dotenv() # Assuming the app.py is inside the 'src' directory -BASE_DIR = os.path.dirname(os.path.abspath(__file__)) # Get the directory of the current file (src folder) -DATABASE_PATH = os.path.join(BASE_DIR, 'votes.db') # Set the database path inside the src folder +# BASE_DIR = os.path.dirname(os.path.abspath(__file__)) # Get the directory of the current file (src folder) +# DATABASE_PATH = os.path.join(BASE_DIR, 'votes.db') # Set the database path inside the src folder + +# This line will get the variable named DATABASE_PATH from the .env file, if it can't find it, it defaults to votes.db +DATABASE_PATH = os.getenv('DATABASE_PATH', 'votes.db') # Initialize Flask App app = Flask(__name__) diff --git a/src/requirements.txt b/src/requirements.txt index 294b16b..19a17b2 100644 Binary files a/src/requirements.txt and b/src/requirements.txt differ