fixing the mess

This commit is contained in:
deflax 2017-03-09 03:31:16 +02:00
parent 05480097c4
commit 360b4d7b21
4 changed files with 16 additions and 16 deletions

View file

@ -1,4 +1,5 @@
from flask import Flask, g, render_template, request from flask import Flask, g, render_template, request
from flask.json import JSONEncoder
from flask_bootstrap import Bootstrap from flask_bootstrap import Bootstrap
from flask_mail import Mail from flask_mail import Mail
from flask_sqlalchemy import SQLAlchemy from flask_sqlalchemy import SQLAlchemy
@ -6,9 +7,11 @@ from flask_login import LoginManager
from flask_wtf.csrf import CSRFProtect, CSRFError from flask_wtf.csrf import CSRFProtect, CSRFError
from flask_babel import Babel, lazy_gettext from flask_babel import Babel, lazy_gettext
from werkzeug.contrib.fixers import ProxyFix from werkzeug.contrib.fixers import ProxyFix
from config import config
app = Flask(__name__) app = Flask(__name__)
app.config.from_object('config') app.config.from_object(config['default'])
config['default'].init_app(app)
app.wsgi_app = ProxyFix(app.wsgi_app) app.wsgi_app = ProxyFix(app.wsgi_app)
db = SQLAlchemy(session_options = { "autoflush": False }) db = SQLAlchemy(session_options = { "autoflush": False })
@ -19,17 +22,14 @@ lm.login_view = 'auth.login'
lm.login_message = 'Login Required.' lm.login_message = 'Login Required.'
lm.session_protection = 'strong' lm.session_protection = 'strong'
#lm.session_protection = 'basic' #lm.session_protection = 'basic'
mail = Mail(app) mail = Mail()
bootstrap = Bootstrap(app) mail.init_app(app)
#csrf = CSRFProtect(app) bootstrap = Bootstrap()
babel = Babel(app) bootstrap.init_app(app)
csrf = CSRFProtect()
#bootstrap.init_app(app) csrf.init_app(app)
#mail.init_app(app) babel = Babel()
#db.init_app(app) babel.init_app(app)
#lm.init_app(app)
#babel.init_app(app)
#csrf.init_app(app)
from .vmanager import vmanager as vmanager_blueprint from .vmanager import vmanager as vmanager_blueprint
app.register_blueprint(vmanager_blueprint) app.register_blueprint(vmanager_blueprint)
@ -109,7 +109,7 @@ if not app.debug and app.config['MAIL_SERVER'] != '':
import logging import logging
from logging.handlers import SMTPHandler from logging.handlers import SMTPHandler
credentials = None credentials = None
secure = Nonep secure = None
if app.config['MAIL_USERNAME'] or app.config['MAIL_PASSWORD']: if app.config['MAIL_USERNAME'] or app.config['MAIL_PASSWORD']:
credentials = (app.config['MAIL_USERNAME'], app.config['MAIL_PASSWORD']) credentials = (app.config['MAIL_USERNAME'], app.config['MAIL_PASSWORD'])
if app.config['MAIL_USE_TLS'] is None: if app.config['MAIL_USE_TLS'] is None:

View file

@ -4,7 +4,7 @@ from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from flask import current_app, request, url_for from flask import current_app, request, url_for
from flask_login import UserMixin, AnonymousUserMixin from flask_login import UserMixin, AnonymousUserMixin
from proxadmin.exceptions import ValidationError from app.exceptions import ValidationError
from . import db, lm from . import db, lm
import os import os

View file

@ -2,7 +2,7 @@
import os import os
import subprocess, shlex import subprocess, shlex
from proxadmin import app, db from app import app, db
from flask_script import Manager, Shell, Command from flask_script import Manager, Shell, Command
from flask_migrate import Migrate, MigrateCommand from flask_migrate import Migrate, MigrateCommand

2
run.py
View file

@ -1,4 +1,4 @@
from proxadmin import app from app import app
if __name__ == '__main__': if __name__ == '__main__':
app.run() app.run()