-
Notifications
You must be signed in to change notification settings - Fork 0
/
dev.py
63 lines (46 loc) · 1.63 KB
/
dev.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import sys
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
import feedparser
import config
from app.models import User
# from app.models import User
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = config.SQLALCHEMY_DATABASE_URI
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db = SQLAlchemy(app)
@app.route('/')
def portal():
return 'Here'
@app.route('/dashboard')
def hello_world():
return 'Hello World!!!'
@app.route('/create_db')
def init_db():
db.create_all()
user1 = User(email='[email protected]')
db.session.add(user1)
db.session.commit()
return 'DB created'
def print_help():
print('Tsukuyomi Development Helper')
print('=======================\n')
print('Usage: {0} command [different arguments]'.format(sys.argv[0]))
print('Command can be one of the following:\n')
print(' lint | check : do a lint check (flake8 + flake8-isort)')
print(' fix | autolint : try and auto-fix lint (autopep8)')
print(' isort : fix import sorting (isort)')
print(' test | pytest : run tests (pytest)')
print(' help | -h | --help : show this help and exit')
print('')
print('You may pass different arguments to the script that is being run.')
print('For example: {0} test tests/ --verbose'.format(sys.argv[0]))
print('')
return 1
def print_cmd(cmd, args):
print('Running: {0}\n'.format(
' '.join([('\'' + a + '\'' if ' ' in a else a) for a in [cmd] + args])))
sys.stdout.flush()
if __name__ == '__main__':
# app.run()
assert sys.version_info >= (3, 6), "Python 3.6 or above is required"