add .env file in project and add use
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import os
|
||||
|
||||
from pymongo import MongoClient
|
||||
|
||||
|
||||
@@ -8,7 +10,10 @@ class UseDB:
|
||||
|
||||
def __init__(self, collection_name):
|
||||
self.series_collection = None
|
||||
self.client = MongoClient('mongodb', 27017)
|
||||
if os.getenv('ENV') == 'production':
|
||||
self.client = MongoClient('mongodb', 27017)
|
||||
else:
|
||||
self.client = MongoClient('localhost', 27017)
|
||||
self.db = self.client['aero']
|
||||
self.series_collection = self.db[collection_name]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user