aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/initialization.py
blob: fd0a59f8cbff09505c9e60fd0297e2b71ae1f438 (plain)
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
#! /usr/bin/env python
# -*- coding: utf-8 -*-

"""initialization.py

Initialization script.
"""

import sys
from mongoengine import *
from werkzeug import generate_password_hash

sys.path.append(".")
import conf
import models

if __name__ == "__main__":
    # Point of entry in execution mode
    firstname = sys.argv[1]
    lastname =  sys.argv[2]
    email = sys.argv[3]
    password = sys.argv[4]

    db = connect(conf.DATABASE_NAME)
    db.drop_database(conf.DATABASE_NAME)

    user = models.User(firstname=firstname, lastname=lastname, \
                email=email, pwdhash=generate_password_hash(password))
    user.save()
bgstack15