update the app on branch dev from GnC
This commit is contained in:
parent
598b76e1eb
commit
665cde961d
@ -21,7 +21,7 @@ RUN echo "appuser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
|
||||
COPY vendor/GeoNature-citizen/ /home/appuser/citizen/
|
||||
|
||||
# patches
|
||||
COPY patches/back/requirements.txt /home/appuser/citizen/backend/requirements.txt
|
||||
#COPY patches/back/requirements.txt /home/appuser/citizen/backend/requirements.txt #use the requirements from the GnC repo
|
||||
COPY patches/back/default_config.toml /home/appuser/citizen/config/default_config.toml
|
||||
COPY patches/settings.ini /home/appuser/citizen/config/settings.ini
|
||||
COPY patches/back/wsgi.py /home/appuser/citizen/backend/wsgi.py
|
||||
|
@ -49,28 +49,24 @@ def get_app(config, _app=None, with_external_mods=True, url_prefix="/api"):
|
||||
|
||||
app = Flask(__name__)
|
||||
app.config.update(config)
|
||||
|
||||
if app.config["DEBUG"]:
|
||||
from flask.logging import default_handler
|
||||
import colorlog
|
||||
|
||||
handler = colorlog.StreamHandler()
|
||||
handler.setFormatter(
|
||||
colorlog.ColoredFormatter(
|
||||
"""%(log_color)s%(asctime)s %(levelname)s:%(name)s:%(message)s [in %(pathname)s:%(lineno)d]"""
|
||||
)
|
||||
)
|
||||
import coloredlogs
|
||||
|
||||
app.config["SQLALCHEMY_ECHO"] = True
|
||||
logger = logging.getLogger("werkzeug")
|
||||
logger.addHandler(handler)
|
||||
app.logger.removeHandler(default_handler)
|
||||
|
||||
for l in logging.Logger.manager.loggerDict.values():
|
||||
if hasattr(l, "handlers"):
|
||||
l.handlers = [handler]
|
||||
coloredlogs.install(
|
||||
level=logging.DEBUG,
|
||||
fmt="%(asctime)s %(hostname)s %(name)s[%(process)d] [in %(pathname)s:%(lineno)d] %(levelname)s %(message)s",
|
||||
)
|
||||
logger.removeHandler(default_handler)
|
||||
|
||||
# for l in logging.Logger.manager.loggerDict.values():
|
||||
# if hasattr(l, "handlers"):
|
||||
# l.handlers = [handler]
|
||||
|
||||
# else:
|
||||
# # TODO: sourced from app.config['LOGGING']
|
||||
# logging.basicConfig()
|
||||
# logger = logging.getLogger()
|
||||
# logger.setLevel(logging.INFO)
|
||||
@ -88,45 +84,33 @@ def get_app(config, _app=None, with_external_mods=True, url_prefix="/api"):
|
||||
|
||||
# Bind app to DB
|
||||
db.init_app(app)
|
||||
|
||||
# JWT Auth
|
||||
jwt.init_app(app)
|
||||
|
||||
swagger.init_app(app)
|
||||
|
||||
admin.init_app(app)
|
||||
|
||||
ckeditor.init_app(app)
|
||||
|
||||
with app.app_context():
|
||||
|
||||
from gncitizen.core.users.routes import routes
|
||||
create_schemas(db)
|
||||
db.create_all()
|
||||
populate_modules(db)
|
||||
|
||||
app.register_blueprint(routes, url_prefix=url_prefix)
|
||||
from gncitizen.core.users.routes import users_api
|
||||
from gncitizen.core.commons.routes import commons_api
|
||||
from gncitizen.core.observations.routes import obstax_api
|
||||
from gncitizen.core.ref_geo.routes import geo_api
|
||||
from gncitizen.core.badges.routes import badges_api
|
||||
from gncitizen.core.taxonomy.routes import taxo_api
|
||||
from gncitizen.core.sites.routes import sites_api
|
||||
|
||||
from gncitizen.core.commons.routes import routes
|
||||
|
||||
app.register_blueprint(routes, url_prefix=url_prefix)
|
||||
|
||||
from gncitizen.core.observations.routes import routes
|
||||
|
||||
app.register_blueprint(routes, url_prefix=url_prefix)
|
||||
|
||||
from gncitizen.core.ref_geo.routes import routes
|
||||
|
||||
app.register_blueprint(routes, url_prefix=url_prefix)
|
||||
|
||||
from gncitizen.core.badges.routes import routes
|
||||
|
||||
app.register_blueprint(routes, url_prefix=url_prefix)
|
||||
|
||||
from gncitizen.core.taxonomy.routes import routes
|
||||
|
||||
app.register_blueprint(routes, url_prefix=url_prefix)
|
||||
|
||||
from gncitizen.core.sites.routes import routes
|
||||
|
||||
app.register_blueprint(routes, url_prefix=url_prefix + "/sites")
|
||||
app.register_blueprint(users_api, url_prefix=url_prefix)
|
||||
app.register_blueprint(commons_api, url_prefix=url_prefix)
|
||||
app.register_blueprint(obstax_api, url_prefix=url_prefix)
|
||||
app.register_blueprint(geo_api, url_prefix=url_prefix)
|
||||
app.register_blueprint(badges_api, url_prefix=url_prefix)
|
||||
app.register_blueprint(taxo_api, url_prefix=url_prefix)
|
||||
app.register_blueprint(sites_api, url_prefix=url_prefix + "/sites")
|
||||
|
||||
CORS(app, supports_credentials=True)
|
||||
|
||||
@ -150,11 +134,8 @@ def get_app(config, _app=None, with_external_mods=True, url_prefix="/api"):
|
||||
module.backend.blueprint.blueprint.config = conf
|
||||
app.config[manifest["module_name"]] = conf
|
||||
|
||||
_app = app
|
||||
# _app = app
|
||||
|
||||
create_schemas(db)
|
||||
db.create_all()
|
||||
populate_modules(db)
|
||||
|
||||
|
||||
return app
|
||||
|
2
vendor/GeoNature-citizen
vendored
2
vendor/GeoNature-citizen
vendored
@ -1 +1 @@
|
||||
Subproject commit 8834fd1698edfab482d913957ef9079b7629887f
|
||||
Subproject commit 3b8b3afaf320636d4f428b0a77b31f78ca742de4
|
Loading…
Reference in New Issue
Block a user