Skip to content

Commit

Permalink
updated config.py
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomorossini committed Jul 5, 2023
1 parent 73a408c commit 2c82699
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions config.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
# External dependencies
import os
import re
from dotenv import load_dotenv, find_dotenv

# Setting up environment
_ = load_dotenv(find_dotenv()) # read local .env file


# Creating Config class
class Config(object):
# Defining the path to the database
root_folder = os.path.dirname(os.path.abspath(__file__))
database_path = os.path.join(root_folder, 'instance', 'database.db')

# Database
SQLALCHEMY_DATABASE_URI = os.getenv('DATABASE_URL') # Connecting app to the database
DATABASE_URL = os.getenv('DATABASE_URL') # Connecting app to the database
if DATABASE_URL and DATABASE_URL.startswith("postgres://"):
DATABASE_URL = DATABASE_URL.replace("postgres://", "postgresql://", 1)
SQLALCHEMY_DATABASE_URI = DATABASE_URL

SECRET_KEY = os.getenv('SECRET_KEY')
# Mail
MAIL_SERVER = 'smtp.googlemail.com'
Expand All @@ -29,9 +33,10 @@ class Config(object):
class DevelopmentConfig(Config):
DEBUG = True
TESTING = False
SQLALCHEMY_DATABASE_URI = f"sqlite:///{Config.database_path}"


# Production Environment
class ProductionConfig(Config):
DEBUG = False
TESTING = False
TESTING = False

0 comments on commit 2c82699

Please sign in to comment.