From 77671bb5604eba3b6084811d2dccd58507f16e44 Mon Sep 17 00:00:00 2001 From: vanzhiganov Date: Mon, 28 Aug 2017 10:22:38 +0300 Subject: [PATCH] update templates --- README.md | 21 +++++++- alembic/versions/2017_08_26_01_01.py | 5 +- alembic/versions/2017_08_27_03_02.py | 4 +- wotstats/init.py | 5 +- wotstats/models/user.py | 1 + wotstats/templates/layouts/main.html | 42 +++++++++------ wotstats/templates/pages/account/index.html | 5 +- wotstats/templates/pages/login.html | 3 +- wotstats/views/home.py | 58 +++++++++++++++------ 9 files changed, 103 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index acd4c75..9f4eeb2 100644 --- a/README.md +++ b/README.md @@ -1 +1,20 @@ -## wtstts/wots-server \ No newline at end of file +# World of Tanks Statistics Server + +## Requirements + +- Ubuntu/Debian Linux +- Postgresql +- Python 2.7 +- Wargaming Developers Account + +## Install + +``` +pip install -r requirements.txt +``` + +### Run + +``` +python app.py +``` diff --git a/alembic/versions/2017_08_26_01_01.py b/alembic/versions/2017_08_26_01_01.py index 446c16a..f6f3b7e 100644 --- a/alembic/versions/2017_08_26_01_01.py +++ b/alembic/versions/2017_08_26_01_01.py @@ -1,4 +1,4 @@ -"""empty message +"""INIT Revision ID: f5e44761054e Revises: @@ -21,10 +21,11 @@ def upgrade(): 'user', sa.Column('id', sa.Integer(), nullable=False), sa.Column('status', sa.Integer(), nullable=False, default=0), + sa.Column('name', sa.String(256), nullable=False, unique=True), sa.Column('email', sa.String(length=256), nullable=False, unique=True), sa.Column('password', sa.String(32), nullable=False), sa.Column('openid', sa.String(256), nullable=True, unique=True), - sa.Column('name', sa.String(256), nullable=False, unique=True), + sa.Column('token', sa.String(length=256), nullable=True), sa.PrimaryKeyConstraint('id') ) pass diff --git a/alembic/versions/2017_08_27_03_02.py b/alembic/versions/2017_08_27_03_02.py index 2b6b9c3..97f8a44 100644 --- a/alembic/versions/2017_08_27_03_02.py +++ b/alembic/versions/2017_08_27_03_02.py @@ -17,8 +17,10 @@ depends_on = None def upgrade(): - pass + # op.add_column('user', sa.Column('token', sa.String(256), nullable=True, )) + pass def downgrade(): + # op.drop_column('user', 'token') pass diff --git a/wotstats/init.py b/wotstats/init.py index 2ad29ef..7e9f514 100644 --- a/wotstats/init.py +++ b/wotstats/init.py @@ -4,6 +4,7 @@ from wotstats.database import db, migrate from wotstats.openid import oid from wotstats.views.home import pages_home from wotstats.views.account import pages_account +from wotstats.views.wallet import pages_wallet def init_app(): app = Flask(__name__) @@ -11,10 +12,11 @@ def init_app(): app.config['SECRET_KEY'] = 'super-secret' app.config['SQLALCHEMY_DATABASE_URI'] = 'postgres://wot:wot@192.168.1.47/wot' app.config['OPENID_FS_STORE_PATH'] = 'tmp' - # + # TODO: rename to WG_APPLICATION_ID app.config['WG_ID'] = '502910c1c785c3c7ca2e83c9e89bde02' # app.config['WG_OPENID_URL'] = 'https://eu.wargaming.net/id/openid/' app.config['WG_OPENID_URL'] = 'https://wargaming.net/id/openid/' + app.config['WG_TOKEN_URL'] = 'https://api.worldoftanks.ru/wot/auth/login/' # , safe_roots=[] oid.init_app(app) @@ -24,6 +26,7 @@ def init_app(): app.register_blueprint(pages_home) app.register_blueprint(pages_account) + app.register_blueprint(pages_wallet) @app.before_request def lookup_current_user(): diff --git a/wotstats/models/user.py b/wotstats/models/user.py index 3b4f675..9ceb0d6 100644 --- a/wotstats/models/user.py +++ b/wotstats/models/user.py @@ -9,6 +9,7 @@ class User(db.Model): password = db.Column(db.String(32), nullable=False) name = db.Column(db.String(256), unique=True, nullable=False) openid = db.Column(db.String(256), unique=True, nullable=True) + token = db.Column(db.String(256), nullable=True) def __init__(self, email): self.email = email diff --git a/wotstats/templates/layouts/main.html b/wotstats/templates/layouts/main.html index 31086a3..26bf37a 100644 --- a/wotstats/templates/layouts/main.html +++ b/wotstats/templates/layouts/main.html @@ -1,24 +1,36 @@ + {% block title %}{% endblock %} + + + + + -

wotstats

- {% if session['openid'] %} - - {% else %} - - {% endif %} - {% block content %}{% endblock %} + {% block content %}{% endblock %} + + + diff --git a/wotstats/templates/pages/account/index.html b/wotstats/templates/pages/account/index.html index f8b1e60..dcc4682 100644 --- a/wotstats/templates/pages/account/index.html +++ b/wotstats/templates/pages/account/index.html @@ -1,10 +1,7 @@ {% extends 'layouts/main.html' %} {% block content %} -{# {account_statistics} #} - - - +

My Statistics