forked from bitslabsyr/stack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
40 lines (30 loc) · 1.2 KB
/
setup.py
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
30
31
32
33
34
35
36
37
38
39
40
#!env/bin/python
import sys
import os
import json
from werkzeug import generate_password_hash
from app.controller import Controller
from app.models import DB
basedir = os.getcwd()
db = DB()
def main():
print '\n'
print 'STACK'
print '----------'
print '\n'
print 'Welcome to the STACK setup tool. Follow the instructions below to\nsetup your first project account and initialize the configuration\nfiles for your STACK toolkit.'
print '\n'
project_name = raw_input('Enter a project account name: ')
password = raw_input('Enter a project account password: ')
description = raw_input('Enter a project account description: ')
hashed_password = generate_password_hash(password)
resp = db.create(project_name=project_name, password=password, hashed_password=hashed_password,
description=description)
if resp['status']:
print '\n'
print 'SUCCESS! You can now login to your account %s from the\n STACK front-end. Happy researching.' % project_name
else:
print '\n'
print 'Oops. Something went wrong. Please try again and make sure\n the account name you entered does not already exist.'
if __name__ == "__main__":
main()