def create_extra_admin_user(email, name, password): "Initializes the administrator of the platform" from werkzeug import generate_password_hash print("Creation of the admin user...") with app.app_context(): user = web.models.User(email=email, name=name, pwdhash=generate_password_hash(password), is_admin=True, is_active=True) db.session.add(user) db.session.commit()
def create_admin_user(): "Initializes the administrator of the platform" from werkzeug import generate_password_hash print("Creation of the admin user...") with app.app_context(): user = web.models.User(email=conf.ADMIN_EMAIL, name=conf.ADMIN_NAME, pwdhash=generate_password_hash(conf.ADMIN_PASSWORD), is_admin=True, is_active=True) db.session.add(user) db.session.commit()
def create_admin_user(): "Initializes the administrator of the platform" from werkzeug import generate_password_hash print("Creation of the admin user...") with app.app_context(): user = web.models.User(email="*****@*****.**", name="admin", pwdhash=generate_password_hash("password"), is_admin=True, is_active=True) db.session.add(user) db.session.commit()
def create_admin_user(): "Initializes the administrator of the platform" from werkzeug import generate_password_hash print("Creation of the admin user...") with app.app_context(): user = web.models.User(email=conf.ADMIN_EMAIL, name=conf.ADMIN_NAME, pwdhash=generate_password_hash( conf.ADMIN_PASSWORD), is_admin=True, is_active=True) db.session.add(user) db.session.commit()
def init_shelters_structure(csv_file, drawnings_folder): "Will initialize the database with the attribute for the shelters." print( "Importing base structure of shelters from '{}' ...".format(csv_file)) with app.app_context(): scripts.init_shelters_structure(csv_file, drawnings_folder)
def create_db_triggers(): "Creates triggers and trigger functions for tables" print("Creating database triggers ...") with app.app_context(): scripts.create_db_triggers()
def export_shelters_pictures(dump_dir, foldername): "Exports shelters pictures into a directory tree" print("Exporting shelter picture directories ...") with app.app_context(): scripts.export_shelters_pictures(dump_dir, foldername)
def db_empty(): "Will drop the database." print("Dropping database...") with app.app_context(): populate_g() web.models.db_empty(db)
def import_shelters_documents(folder): "Import documents for shelters" print("Importing documents from '{}' ...".format(folder)) with app.app_context(): scripts.import_shelters_documents(folder)
def create_shelters_thumbnails(): "Creates thumbnails of the cover pictures of shelters" print("Creating shelter picture thumbnails ...") with app.app_context(): scripts.create_shelters_thumbnails()
def db_init(): "Will initialize the database." print("Initialization of the database...") with app.app_context(): populate_g() web.models.db_init(db)
def import_translation(translation_file, language_code): "Import a translation file in the database" print("Importing translation file from '{}' ...".format(translation_file)) with app.app_context(): scripts.import_translation(translation_file, language_code)
def uml_graph(): "UML graph from the models." with app.app_context(): web.models.uml_graph(db)
def export_shelters(dump_file, truncate): "Exports shelters as a CSV dump file" print("Exporting shelter data ...") with app.app_context(): scripts.export_shelters(dump_file, truncate)
def import_shelters(shelters_owner, csv_file): "Will import the shelters in the database." print("Importing shelters from '{}' ...".format(csv_file)) with app.app_context(): scripts.populate_shelters(shelters_owner, csv_file)
def init_shelters_structure(csv_file, drawnings_folder): "Will initialize the database with the attribute for the shelters." print("Importing base structure of shelters from '{}' ...".format(csv_file)) with app.app_context(): scripts.init_shelters_structure(csv_file, drawnings_folder)
def import_page(name, html_file, language_code): "Import a page (HTML file) in the database" print("Importing page from '{}' ...".format(html_file)) with app.app_context(): scripts.init_page(name, html_file, language_code)
def import_shelters_pictures(folder): "Import pictures for shelters" print("Importing pictures from '{}' ...".format(folder)) with app.app_context(): scripts.import_shelters_pictures(folder)
def db_create(): "Will create the database." print("Creation of the database...") with app.app_context(): populate_g() web.models.db_create(db)
def create_user(email, name, password): "Initializes a user" print("Creation of the user {} ...".format(name)) with app.app_context(): scripts.create_user(email, name, password)
# # # # ***** END LICENSE BLOCK ***** __author__ = "Cedric Bonhomme" __version__ = "$Revision: 0.1 $" __date__ = "$Date: 2016/03/30 $" __revision__ = "$Date: 2016/08/07 $" __copyright__ = "Copyright (c) " __license__ = "" from bootstrap import conf, app, populate_g import os with app.app_context(): populate_g() # HTML views from web import views app.register_blueprint(views.user_bp) app.register_blueprint(views.shelter_bp) app.register_blueprint(views.shelters_bp) app.register_blueprint(views.admin_bp) # API v0.1 app.register_blueprint(views.api.blueprint_user) app.register_blueprint(views.api.blueprint_shelter) app.register_blueprint(views.api.blueprint_shelter_picture) app.register_blueprint(views.api.blueprint_section) app.register_blueprint(views.api.blueprint_category)
# All rights reserved. # # # # ***** END LICENSE BLOCK ***** __author__ = "Cedric Bonhomme" __version__ = "$Revision: 0.1 $" __date__ = "$Date: 2016/03/30 $" __revision__ = "$Date: 2016/08/07 $" __copyright__ = "Copyright (c) " __license__ = "" from bootstrap import conf, app, populate_g with app.app_context(): populate_g() # HTML views from web import views app.register_blueprint(views.user_bp) app.register_blueprint(views.shelter_bp) app.register_blueprint(views.shelters_bp) app.register_blueprint(views.admin_bp) # API v0.1 app.register_blueprint(views.api.blueprint_user) app.register_blueprint(views.api.blueprint_shelter) app.register_blueprint(views.api.blueprint_shelter_picture) app.register_blueprint(views.api.blueprint_section) app.register_blueprint(views.api.blueprint_category)