Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ def create_app():
load_dotenv()

app = Flask(__name__)
app.config["MONGO_CONNECTION"] = os.getenv("MONGO_CONNECTION")
app.config["MONGO_URI"] = os.getenv("MONGO_URI")
app.config["MONGO_DB"] = os.getenv("MONGO_DB")

api.init_app(app)

Expand Down
4 changes: 2 additions & 2 deletions src/config/db_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

def create_conn():
"""Create database connection"""
client = MongoClient(current_app.config["MONGO_CONNECTION"])
db = client.da
client = MongoClient(current_app.config["MONGO_URI"])
db = client[current_app.config["MONGO_DB"]]
collection = db.dates

return collection
6 changes: 4 additions & 2 deletions test/fixtures/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ def client():
from app import app

test_mongodb_uri = 'mongodb://localhost/test'
test_db_name = 'test'

app.config.update({
"MONGO_CONNECTION": test_mongodb_uri,
"MONGO_URI": test_mongodb_uri,
"MONGO_DB": test_db_name,
"TESTING": True,
})

Expand All @@ -19,4 +21,4 @@ def client():
yield test_client

mongo = MongoClient(test_mongodb_uri)
mongo.drop_database('test')
mongo.drop_database(test_db_name)