aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/initialization.py
blob: 5777ca126ed0d50fc7fbe89ac50aa1f531143741 (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 models

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

    db = connect(database)
    db.drop_database(database)

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