aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/initialization.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyaggr3g470r/initialization.py')
-rw-r--r--pyaggr3g470r/initialization.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/pyaggr3g470r/initialization.py b/pyaggr3g470r/initialization.py
new file mode 100644
index 00000000..5777ca12
--- /dev/null
+++ b/pyaggr3g470r/initialization.py
@@ -0,0 +1,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() \ No newline at end of file
bgstack15