forked from Pulsar312/Produce-Pong
-
Notifications
You must be signed in to change notification settings - Fork 0
/
database.py
21 lines (18 loc) · 877 Bytes
/
database.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Create database collections here, and pass as parameter
import os
import pymongo
client = pymongo.MongoClient(os.getenv("MONGO_HOST", "localhost:27055"))
db = client.mydata
users = db.users # creating/retrieving a collection for saving usernames and passwords
count_users = db.count_users # creating/retrieving a collection for saving the amount of users we have
sessions = db.sessions # Keep users logged in with cookies
user_profiles = db.profile_images # creating/retrieving a collection for saving the user with their associated profile image
logged_in = db.logged_in_user
pong_db = db.pong_db
achievements = db.achievements # Save the users with their achievements
historic_games = db.historic_games
messages = db.messages
def initialize():
# Force this file to be run when the app is started
# Import this file anywhere we need a db connection
pass