-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdatamodels.py
More file actions
36 lines (25 loc) · 828 Bytes
/
datamodels.py
File metadata and controls
36 lines (25 loc) · 828 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
'''
Database client setup for the "aprender" app
'''
# TODO enable auth
# https://docs.mongodb.com/v3.2/tutorial/enable-authentication/
import arrow
from passlib.hash import pbkdf2_sha512
from pymongo import MongoClient
from secure import MONGO_USERNAME, MONGO_PASSWORD
from uuid import uuid4
# SET UP THE CONNECTION
client = MongoClient("localhost", 27017)
db = client["aprender"]
scorecards = client["scorecards"]
thingstolearn = client["thingstolearn"]
users = client["users"]
# AUTHENTICATE THE CONNECTION
client.aprender.authenticate(MONGO_USERNAME, MONGO_PASSWORD, mechanism='SCRAM-SHA-1')
'''
print("using db {}".format(db.name))
print("using collection {}".format(db.thingstolearn.name))
someword = db.thingstolearn.find_one()
print(someword)
print("a word is {}".format(someword["word"]))
'''