This commit is contained in:
RemiZOffAlex
2019-04-26 15:38:41 +03:00
parent 48ebf82a1f
commit 60802cec8e
21 changed files with 48 additions and 75 deletions

View File

@@ -1,11 +1,8 @@
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
__author__ = 'RemiZOffAlex'
__copyright__ = '(c) RemiZOffAlex'
__license__ = 'MIT'
__email__ = 'remizoffalex@mail.ru'
__url__ = 'http://remizoffalex.ru'
__url__ = 'https://remizoffalex.ru'
import config
import logging
@@ -19,9 +16,11 @@ app.config.from_object(config.CONFIG)
app.config.from_envvar('FLASKR_SETTINGS', silent=True)
# Логирование
handler = RotatingFileHandler(app.config['LOG_FILE'],
handler = RotatingFileHandler(
app.config['LOG_FILE'],
maxBytes=app.config['LOG_FILE_SIZE']*1024*1024,
backupCount=1)
backupCount=1
)
handler.setLevel(logging.INFO)
formatter = logging.Formatter(app.config['LONG_LOG_FORMAT'])
handler.setFormatter(formatter)

View File

@@ -1,10 +1,8 @@
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
__author__ = 'RemiZOffAlex'
__copyright__ = '(c) RemiZOffAlex'
__license__ = 'MIT'
__email__ = 'remizoffalex@mail.ru'
__url__ = 'https://remizoffalex.ru'
from .users import LoginForm
from .page import PageEdit

View File

@@ -1,17 +1,12 @@
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
__author__ = 'RemiZOffAlex'
__copyright__ = '(c) RemiZOffAlex'
__license__ = 'MIT'
__email__ = 'remizoffalex@mail.ru'
__url__ = 'http://remizoffalex.ru'
__url__ = 'https://remizoffalex.ru'
from wtforms import (
Form,
BooleanField,
TextField,
PasswordField,
TextAreaField
)

View File

@@ -1,13 +1,11 @@
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
__author__ = 'RemiZOffAlex'
__copyright__ = '(c) RemiZOffAlex'
__license__ = 'MIT'
__email__ = 'remizoffalex@mail.ru'
__url__ = 'http://remizoffalex.ru'
__url__ = 'https://remizoffalex.ru'
from wtforms import Form, TextField, PasswordField
from wtforms import Form, BooleanField, TextField, PasswordField
class LoginForm(Form):
username = TextField('Имя пользователя')

View File

@@ -1,10 +1,8 @@
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
__author__ = 'RemiZOffAlex'
__copyright__ = '(c) RemiZOffAlex'
__license__ = 'MIT'
__email__ = 'remizoffalex@mail.ru'
__url__ = 'https://remizoffalex.ru'
from .pagination import Pagination, getpage
from .passwd import pwgen, get_hash_password

View File

@@ -1,17 +1,16 @@
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
__author__ = 'RemiZOffAlex'
__copyright__ = '(c) RemiZOffAlex'
__license__ = 'MIT'
__email__ = 'remizoffalex@mail.ru'
__url__ = 'http://remizoffalex.ru'
__url__ = 'https://remizoffalex.ru'
from flask import session, request
from .. import app, models
def get_user():
"""Получить текущего пользователя"""
"""
Получить текущего пользователя
"""
result = None
if 'user_id' in session:
result = models.db_session.query(

View File

@@ -1,10 +1,8 @@
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
__author__ = 'RemiZOffAlex'
__copyright__ = '(c) RemiZOffAlex'
__license__ = 'MIT'
__email__ = 'remizoffalex@mail.ru'
__url__ = 'https://remizoffalex.ru'
from math import ceil

View File

@@ -1,10 +1,8 @@
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
__author__ = 'RemiZOffAlex'
__copyright__ = '(c) RemiZOffAlex'
__license__ = 'MIT'
__email__ = 'remizoffalex@mail.ru'
__url__ = 'https://remizoffalex.ru'
def gettree(number, count=3):
"""

View File

@@ -1,11 +1,8 @@
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
__author__ = 'RemiZOffAlex'
__copyright__ = '(c) RemiZOffAlex'
__license__ = 'MIT'
__email__ = 'remizoffalex@mail.ru'
__url__ = 'http://remizoffalex.ru'
__url__ = 'https://remizoffalex.ru'
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker

View File

@@ -1,11 +1,8 @@
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
__author__ = 'RemiZOffAlex'
__copyright__ = '(c) RemiZOffAlex'
__license__ = 'MIT'
__email__ = 'remizoffalex@mail.ru'
__url__ = 'http://remizoffalex.ru'
__url__ = 'https://remizoffalex.ru'
import datetime
from sqlalchemy import (
@@ -23,6 +20,9 @@ from . import Base
class User(Base):
"""
Пользователи
"""
__tablename__ = "user"
id = Column(Integer, primary_key=True)

View File

@@ -1,11 +1,8 @@
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
__author__ = 'RemiZOffAlex'
__copyright__ = '(c) RemiZOffAlex'
__license__ = 'MIT'
__email__ = 'remizoffalex@mail.ru'
__url__ = 'http://remizoffalex.ru'
__url__ = 'https://remizoffalex.ru'
from flask_jsonrpc import JSONRPC

View File

@@ -1,11 +1,8 @@
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
__author__ = 'RemiZOffAlex'
__copyright__ = '(c) RemiZOffAlex'
__license__ = 'MIT'
__email__ = 'remizoffalex@mail.ru'
__url__ = 'http://remizoffalex.ru'
__url__ = 'https://remizoffalex.ru'
from flask import abort, escape

View File

@@ -1,11 +1,8 @@
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
__author__ = 'RemiZOffAlex'
__copyright__ = '(c) RemiZOffAlex'
__license__ = 'MIT'
__email__ = 'remizoffalex@mail.ru'
__url__ = 'http://remizoffalex.ru'
__url__ = 'https://remizoffalex.ru'
import os
import jinja2

View File

@@ -1,11 +1,8 @@
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
__author__ = 'RemiZOffAlex'
__copyright__ = '(c) RemiZOffAlex'
__license__ = 'MIT'
__email__ = 'remizoffalex@mail.ru'
__url__ = 'http://remizoffalex.ru'
__url__ = 'https://remizoffalex.ru'
from flask import render_template

View File

@@ -1,10 +1,8 @@
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
__author__ = 'RemiZOffAlex'
__copyright__ = '(c) RemiZOffAlex'
__license__ = 'MIT'
__email__ = 'remizoffalex@mail.ru'
__url__ = 'https://remizoffalex.ru'
from myapp import app
from flask import Flask, render_template, request
@@ -45,6 +43,9 @@ def edit():
@app.route('/login', methods=['GET', 'POST'])
def login():
"""
Логин
"""
pagedata = {}
pagedata['form'] = forms.LoginForm(request.form)
body = render_template('login.html', pagedata=pagedata)