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

"""initialization.py

Initialization script.
"""

import sys
from mongoengine import *
from werkzeug import generate_password_hash

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