Browse Source

Cleanup libs

front-experiment
squeaky otter 2 years ago
parent
commit
5bf5e09e52
Signed by: dashie GPG Key ID: C2D57B325840B755
  1. 1
      CHANGELOG.md
  2. 24
      app.py
  3. 18
      config.py.sample
  4. 4
      requirements.txt
  5. 6
      setup.py

1
CHANGELOG.md

@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- **Breaking:** Services files now uses gunicorn for production, please update according to `installation/pyairwaves-*.service` and `installation/nginx.conf`
- Javascript libraries updated
- Maps changed from B&W OSM to only OSM ones plus ESRI World View
- Cleanup some unused python libs
### Fixed
- Debug/console.log cleanups

24
app.py

@ -3,9 +3,7 @@ import logging
import os
import subprocess
from logging.handlers import RotatingFileHandler
from flask_babelex import Babel
from flask import Flask, g, jsonify, request
from flask_mail import Mail
from flask import Flask, g, jsonify
from flask_migrate import Migrate
from flask_socketio import SocketIO
from models import db
@ -38,7 +36,6 @@ except ImportError:
HAS_SENTRY = False
eventlet.monkey_patch()
mail = Mail()
socketio = SocketIO(cors_allowed_origins="*")
@ -74,9 +71,7 @@ def create_app(config_filename="config.py"):
file_handler.setFormatter(formatter)
app.logger.addHandler(file_handler)
mail.init_app(app)
migrate = Migrate(app, db) # noqa: F841
babel = Babel(app) # noqa: F841
toolbar = DebugToolbarExtension(app) # noqa: F841
db.init_app(app)
@ -88,23 +83,6 @@ def create_app(config_filename="config.py"):
if git_version:
git_version = git_version.strip().decode("UTF-8")
@babel.localeselector
def get_locale():
# if a user is logged in, use the locale from the user settings
identity = getattr(g, "identity", None)
if identity is not None and identity.id:
return identity.user.locale
# otherwise try to guess the language from the user accept
# header the browser transmits. We support fr/en in this
# example. The best match wins.
return request.accept_languages.best_match(["fr", "en"])
@babel.timezoneselector
def get_timezone():
identity = getattr(g, "identity", None)
if identity is not None and identity.id:
return identity.user.timezone
@app.before_request
def before_request():
cfg = {

18
config.py.sample

@ -32,15 +32,6 @@ AIS_SOURCE = {'host': 'patate', 'port': 10110, "name": "patate", "reconnect_dela
SECRET_KEY = "pls fill me"
# Mail setup
MAIL_SERVER = "localhost"
MAIL_PORT = 25
MAIL_USE_TLS = False
MAIL_USE_SSL = False
MAIL_USERNAME = None
MAIL_PASSWORD = None
MAIL_DEFAULT_SENDER = f"postmaster@yourdomain"
# Development only options
DEBUG = False
TESTING = False
@ -56,12 +47,3 @@ SQLALCHEMY_RECORD_QUERIES = True
SECURITY_CHANGEABLE = True
# Password hash algorithm
SECURITY_PASSWORD_HASH = 'bcrypt'
SECURITY_SEND_REGISTER_EMAIL = True
SECURITY_SEND_PASSWORD_CHANGE_EMAIL = True
SECURITY_SEND_PASSWORD_RESET_NOTICE_EMAIL = True
BOOTSTRAP_USE_MINIFIED = True
BOOTSTRAP_SERVE_LOCAL = True
BOOTSTRAP_QUERYSTRING_REVVING = True
BABEL_DEFAULT_TIMEZONE = "UTC"

4
requirements.txt

@ -1,19 +1,15 @@
Flask_Babelex==0.9.4
psycopg2-binary==2.8.4
texttable==1.6.2
Unidecode==1.1.1
python-magic==0.4.15
flask==1.1.1
python-slugify==4.0.0
wtforms==2.2.1
sqlalchemy==1.3.13
bcrypt==3.1.7
flask_mail==0.9.1
flask_migrate==2.5.2
sqlalchemy_searchable==1.1.0
flask_debugtoolbar==0.10.1
redis==3.4.1
Bootstrap-Flask==1.2.0
pyais==1.0.0
Flask-SocketIO==4.2.1
eventlet==0.25.1

6
setup.py

@ -14,19 +14,13 @@ setup(
"SQLAlchemy",
"SQLAlchemy-Searchable",
"SQLAlchemy-Utils",
"SQLAlchemy-Continuum",
"Bootstrap-Flask",
"Flask-DebugToolbar",
"Flask-Mail",
"Flask-Migrate",
"Flask-SQLAlchemy",
"bcrypt",
"psycopg2-binary",
"unidecode",
"Flask_Babelex",
"texttable",
"python-slugify",
"python-magic",
"redis",
"flask-socketio",
"eventlet",

Loading…
Cancel
Save