Update
This commit is contained in:
@@ -1,9 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
# -*- coding: UTF-8 -*-
|
|
||||||
|
|
||||||
__author__ = 'RemiZOffAlex'
|
__author__ = 'RemiZOffAlex'
|
||||||
__copyright__ = '(c) RemiZOffAlex'
|
__copyright__ = '(c) RemiZOffAlex'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__email__ = 'remizoffalex@mail.ru'
|
__email__ = 'remizoffalex@mail.ru'
|
||||||
|
__url__ = 'https://remizoffalex.ru'
|
||||||
|
|
||||||
CONFIG = 'config.demo'
|
CONFIG = 'config.demo'
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
# -*- coding: UTF-8 -*-
|
|
||||||
|
|
||||||
__author__ = 'RemiZOffAlex'
|
__author__ = 'RemiZOffAlex'
|
||||||
__copyright__ = '(c) RemiZOffAlex'
|
__copyright__ = '(c) RemiZOffAlex'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__email__ = 'remizoffalex@mail.ru'
|
__email__ = 'remizoffalex@mail.ru'
|
||||||
|
__url__ = 'https://remizoffalex.ru'
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
# -*- coding: UTF-8 -*-
|
|
||||||
|
|
||||||
__author__ = 'RemiZOffAlex'
|
__author__ = 'RemiZOffAlex'
|
||||||
__copyright__ = '(c) RemiZOffAlex'
|
__copyright__ = '(c) RemiZOffAlex'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__email__ = 'remizoffalex@mail.ru'
|
__email__ = 'remizoffalex@mail.ru'
|
||||||
__url__ = 'http://remizoffalex.ru'
|
__url__ = 'https://remizoffalex.ru'
|
||||||
|
|
||||||
import config
|
import config
|
||||||
import logging
|
import logging
|
||||||
@@ -19,9 +16,11 @@ app.config.from_object(config.CONFIG)
|
|||||||
app.config.from_envvar('FLASKR_SETTINGS', silent=True)
|
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,
|
maxBytes=app.config['LOG_FILE_SIZE']*1024*1024,
|
||||||
backupCount=1)
|
backupCount=1
|
||||||
|
)
|
||||||
handler.setLevel(logging.INFO)
|
handler.setLevel(logging.INFO)
|
||||||
formatter = logging.Formatter(app.config['LONG_LOG_FORMAT'])
|
formatter = logging.Formatter(app.config['LONG_LOG_FORMAT'])
|
||||||
handler.setFormatter(formatter)
|
handler.setFormatter(formatter)
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
# -*- coding: UTF-8 -*-
|
|
||||||
|
|
||||||
__author__ = 'RemiZOffAlex'
|
__author__ = 'RemiZOffAlex'
|
||||||
__copyright__ = '(c) RemiZOffAlex'
|
__copyright__ = '(c) RemiZOffAlex'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__email__ = 'remizoffalex@mail.ru'
|
__email__ = 'remizoffalex@mail.ru'
|
||||||
|
__url__ = 'https://remizoffalex.ru'
|
||||||
|
|
||||||
from .users import LoginForm
|
from .users import LoginForm
|
||||||
from .page import PageEdit
|
from .page import PageEdit
|
||||||
|
|||||||
@@ -1,17 +1,12 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
# -*- coding: UTF-8 -*-
|
|
||||||
|
|
||||||
__author__ = 'RemiZOffAlex'
|
__author__ = 'RemiZOffAlex'
|
||||||
__copyright__ = '(c) RemiZOffAlex'
|
__copyright__ = '(c) RemiZOffAlex'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__email__ = 'remizoffalex@mail.ru'
|
__email__ = 'remizoffalex@mail.ru'
|
||||||
__url__ = 'http://remizoffalex.ru'
|
__url__ = 'https://remizoffalex.ru'
|
||||||
|
|
||||||
from wtforms import (
|
from wtforms import (
|
||||||
Form,
|
Form,
|
||||||
BooleanField,
|
|
||||||
TextField,
|
TextField,
|
||||||
PasswordField,
|
|
||||||
TextAreaField
|
TextAreaField
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
# -*- coding: UTF-8 -*-
|
|
||||||
|
|
||||||
__author__ = 'RemiZOffAlex'
|
__author__ = 'RemiZOffAlex'
|
||||||
__copyright__ = '(c) RemiZOffAlex'
|
__copyright__ = '(c) RemiZOffAlex'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__email__ = 'remizoffalex@mail.ru'
|
__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):
|
class LoginForm(Form):
|
||||||
username = TextField('Имя пользователя')
|
username = TextField('Имя пользователя')
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
# -*- coding: UTF-8 -*-
|
|
||||||
|
|
||||||
__author__ = 'RemiZOffAlex'
|
__author__ = 'RemiZOffAlex'
|
||||||
__copyright__ = '(c) RemiZOffAlex'
|
__copyright__ = '(c) RemiZOffAlex'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__email__ = 'remizoffalex@mail.ru'
|
__email__ = 'remizoffalex@mail.ru'
|
||||||
|
__url__ = 'https://remizoffalex.ru'
|
||||||
|
|
||||||
from .pagination import Pagination, getpage
|
from .pagination import Pagination, getpage
|
||||||
from .passwd import pwgen, get_hash_password
|
from .passwd import pwgen, get_hash_password
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
# -*- coding: UTF-8 -*-
|
|
||||||
|
|
||||||
__author__ = 'RemiZOffAlex'
|
__author__ = 'RemiZOffAlex'
|
||||||
__copyright__ = '(c) RemiZOffAlex'
|
__copyright__ = '(c) RemiZOffAlex'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__email__ = 'remizoffalex@mail.ru'
|
__email__ = 'remizoffalex@mail.ru'
|
||||||
__url__ = 'http://remizoffalex.ru'
|
__url__ = 'https://remizoffalex.ru'
|
||||||
|
|
||||||
from flask import session, request
|
from flask import session, request
|
||||||
from .. import app, models
|
from .. import app, models
|
||||||
|
|
||||||
def get_user():
|
def get_user():
|
||||||
"""Получить текущего пользователя"""
|
"""
|
||||||
|
Получить текущего пользователя
|
||||||
|
"""
|
||||||
result = None
|
result = None
|
||||||
if 'user_id' in session:
|
if 'user_id' in session:
|
||||||
result = models.db_session.query(
|
result = models.db_session.query(
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
# -*- coding: UTF-8 -*-
|
|
||||||
|
|
||||||
__author__ = 'RemiZOffAlex'
|
__author__ = 'RemiZOffAlex'
|
||||||
__copyright__ = '(c) RemiZOffAlex'
|
__copyright__ = '(c) RemiZOffAlex'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__email__ = 'remizoffalex@mail.ru'
|
__email__ = 'remizoffalex@mail.ru'
|
||||||
|
__url__ = 'https://remizoffalex.ru'
|
||||||
|
|
||||||
from math import ceil
|
from math import ceil
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
# -*- coding: UTF-8 -*-
|
|
||||||
|
|
||||||
__author__ = 'RemiZOffAlex'
|
__author__ = 'RemiZOffAlex'
|
||||||
__copyright__ = '(c) RemiZOffAlex'
|
__copyright__ = '(c) RemiZOffAlex'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__email__ = 'remizoffalex@mail.ru'
|
__email__ = 'remizoffalex@mail.ru'
|
||||||
|
__url__ = 'https://remizoffalex.ru'
|
||||||
|
|
||||||
def gettree(number, count=3):
|
def gettree(number, count=3):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
# -*- coding: UTF-8 -*-
|
|
||||||
|
|
||||||
__author__ = 'RemiZOffAlex'
|
__author__ = 'RemiZOffAlex'
|
||||||
__copyright__ = '(c) RemiZOffAlex'
|
__copyright__ = '(c) RemiZOffAlex'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__email__ = 'remizoffalex@mail.ru'
|
__email__ = 'remizoffalex@mail.ru'
|
||||||
__url__ = 'http://remizoffalex.ru'
|
__url__ = 'https://remizoffalex.ru'
|
||||||
|
|
||||||
from sqlalchemy import create_engine
|
from sqlalchemy import create_engine
|
||||||
from sqlalchemy.orm import scoped_session, sessionmaker
|
from sqlalchemy.orm import scoped_session, sessionmaker
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
# -*- coding: UTF-8 -*-
|
|
||||||
|
|
||||||
__author__ = 'RemiZOffAlex'
|
__author__ = 'RemiZOffAlex'
|
||||||
__copyright__ = '(c) RemiZOffAlex'
|
__copyright__ = '(c) RemiZOffAlex'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__email__ = 'remizoffalex@mail.ru'
|
__email__ = 'remizoffalex@mail.ru'
|
||||||
__url__ = 'http://remizoffalex.ru'
|
__url__ = 'https://remizoffalex.ru'
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
from sqlalchemy import (
|
from sqlalchemy import (
|
||||||
@@ -23,6 +20,9 @@ from . import Base
|
|||||||
|
|
||||||
|
|
||||||
class User(Base):
|
class User(Base):
|
||||||
|
"""
|
||||||
|
Пользователи
|
||||||
|
"""
|
||||||
__tablename__ = "user"
|
__tablename__ = "user"
|
||||||
|
|
||||||
id = Column(Integer, primary_key=True)
|
id = Column(Integer, primary_key=True)
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
# -*- coding: UTF-8 -*-
|
|
||||||
|
|
||||||
__author__ = 'RemiZOffAlex'
|
__author__ = 'RemiZOffAlex'
|
||||||
__copyright__ = '(c) RemiZOffAlex'
|
__copyright__ = '(c) RemiZOffAlex'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__email__ = 'remizoffalex@mail.ru'
|
__email__ = 'remizoffalex@mail.ru'
|
||||||
__url__ = 'http://remizoffalex.ru'
|
__url__ = 'https://remizoffalex.ru'
|
||||||
|
|
||||||
from flask_jsonrpc import JSONRPC
|
from flask_jsonrpc import JSONRPC
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
# -*- coding: UTF-8 -*-
|
|
||||||
|
|
||||||
__author__ = 'RemiZOffAlex'
|
__author__ = 'RemiZOffAlex'
|
||||||
__copyright__ = '(c) RemiZOffAlex'
|
__copyright__ = '(c) RemiZOffAlex'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__email__ = 'remizoffalex@mail.ru'
|
__email__ = 'remizoffalex@mail.ru'
|
||||||
__url__ = 'http://remizoffalex.ru'
|
__url__ = 'https://remizoffalex.ru'
|
||||||
|
|
||||||
from flask import abort, escape
|
from flask import abort, escape
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
# -*- coding: UTF-8 -*-
|
|
||||||
|
|
||||||
__author__ = 'RemiZOffAlex'
|
__author__ = 'RemiZOffAlex'
|
||||||
__copyright__ = '(c) RemiZOffAlex'
|
__copyright__ = '(c) RemiZOffAlex'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__email__ = 'remizoffalex@mail.ru'
|
__email__ = 'remizoffalex@mail.ru'
|
||||||
__url__ = 'http://remizoffalex.ru'
|
__url__ = 'https://remizoffalex.ru'
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import jinja2
|
import jinja2
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
# -*- coding: UTF-8 -*-
|
|
||||||
|
|
||||||
__author__ = 'RemiZOffAlex'
|
__author__ = 'RemiZOffAlex'
|
||||||
__copyright__ = '(c) RemiZOffAlex'
|
__copyright__ = '(c) RemiZOffAlex'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__email__ = 'remizoffalex@mail.ru'
|
__email__ = 'remizoffalex@mail.ru'
|
||||||
__url__ = 'http://remizoffalex.ru'
|
__url__ = 'https://remizoffalex.ru'
|
||||||
|
|
||||||
from flask import render_template
|
from flask import render_template
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
# -*- coding: UTF-8 -*-
|
|
||||||
|
|
||||||
__author__ = 'RemiZOffAlex'
|
__author__ = 'RemiZOffAlex'
|
||||||
__copyright__ = '(c) RemiZOffAlex'
|
__copyright__ = '(c) RemiZOffAlex'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__email__ = 'remizoffalex@mail.ru'
|
__email__ = 'remizoffalex@mail.ru'
|
||||||
|
__url__ = 'https://remizoffalex.ru'
|
||||||
|
|
||||||
from myapp import app
|
from myapp import app
|
||||||
from flask import Flask, render_template, request
|
from flask import Flask, render_template, request
|
||||||
@@ -45,6 +43,9 @@ def edit():
|
|||||||
|
|
||||||
@app.route('/login', methods=['GET', 'POST'])
|
@app.route('/login', methods=['GET', 'POST'])
|
||||||
def login():
|
def login():
|
||||||
|
"""
|
||||||
|
Логин
|
||||||
|
"""
|
||||||
pagedata = {}
|
pagedata = {}
|
||||||
pagedata['form'] = forms.LoginForm(request.form)
|
pagedata['form'] = forms.LoginForm(request.form)
|
||||||
body = render_template('login.html', pagedata=pagedata)
|
body = render_template('login.html', pagedata=pagedata)
|
||||||
|
|||||||
7
run.py
7
run.py
@@ -1,5 +1,10 @@
|
|||||||
#!/usr/bin/env python3
|
#!/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 as application
|
from myapp import app as application
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: UTF-8 -*-
|
|
||||||
|
|
||||||
__author__ = 'RemiZOffAlex'
|
__author__ = 'RemiZOffAlex'
|
||||||
__copyright__ = '(c) RemiZOffAlex'
|
__copyright__ = '(c) RemiZOffAlex'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__email__ = 'remizoffalex@mail.ru'
|
__email__ = 'remizoffalex@mail.ru'
|
||||||
__url__ = 'http://remizoffalex.ru'
|
__url__ = 'https://remizoffalex.ru'
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
@@ -18,8 +17,10 @@ from myapp import app, lib, models
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description='Скрипт добавления пользователя',
|
parser = argparse.ArgumentParser(
|
||||||
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
description='Скрипт добавления пользователя',
|
||||||
|
formatter_class=argparse.ArgumentDefaultsHelpFormatter
|
||||||
|
)
|
||||||
parser._optionals.title = "Необязательные аргументы"
|
parser._optionals.title = "Необязательные аргументы"
|
||||||
|
|
||||||
parser.add_argument("--user", dest="user", required=True, help="Новый пользователь")
|
parser.add_argument("--user", dest="user", required=True, help="Новый пользователь")
|
||||||
|
|||||||
3
wsgi.py
3
wsgi.py
@@ -1,10 +1,9 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: UTF-8 -*-
|
|
||||||
|
|
||||||
__author__ = 'RemiZOffAlex'
|
__author__ = 'RemiZOffAlex'
|
||||||
__copyright__ = '(c) RemiZOffAlex'
|
__copyright__ = '(c) RemiZOffAlex'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__email__ = 'remizoffalex@mail.ru'
|
__email__ = 'remizoffalex@mail.ru'
|
||||||
__url__ = 'http://remizoffalex.ru'
|
__url__ = 'https://remizoffalex.ru'
|
||||||
|
|
||||||
from myapp import app as application
|
from myapp import app as application
|
||||||
|
|||||||
Reference in New Issue
Block a user