Skip to content
This repository has been archived by the owner on May 19, 2020. It is now read-only.

Commit

Permalink
Add script for generate a token
Browse files Browse the repository at this point in the history
  • Loading branch information
Ydrasil committed Jun 21, 2017
1 parent 2382c7c commit 7e6b499
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions bin/generate-token.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import os

from flask import Flask
from tcidatabase import db
from tcidatabase.models import BaseToken, SurveyToken, Client, User

PROJECT_PATH = os.path.abspath(os.path.dirname(__file__) + '/..')
os.environ.setdefault('SETTINGS', PROJECT_PATH + '/settings.py')

app = Flask('tci-online')
app.config.from_envvar('SETTINGS')

app.root_path = PROJECT_PATH
app.secret_key = app.config['SECRET_KEY']

db.connect(**app.config['DATABASE'])

User.objects.delete()
provider = User().save()
client = Client(provider=provider, lastname='Jack').save()
survey = SurveyToken(client=client, provider=provider, survey='tcims').save()
print(survey)

0 comments on commit 7e6b499

Please sign in to comment.