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

Add script for generate a token #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)