From 47fe5c34cb86c83221222845c55765eb9479315d Mon Sep 17 00:00:00 2001 From: Ross Mountjoy Date: Wed, 29 Jan 2020 07:21:00 -0500 Subject: [PATCH] 1 --- app_templates.ini | 6 + dashmachine/dashmachine_init.py | 30 ----- dashmachine/error_pages/routes.py | 8 +- dashmachine/main/utils.py | 30 +++++ dashmachine/paths.py | 2 + dashmachine/rest_api/resources.py | 10 +- dashmachine/settings_system/routes.py | 12 +- dashmachine/settings_system/utils.py | 10 +- dashmachine/static/css/global/dashmachine.css | 5 - dashmachine/static/images/icons | 1 + dashmachine/static/js/global/dashmachine.js | 65 +---------- dashmachine/templates/main/base.html | 4 +- dashmachine/templates/main/home.html | 51 +++++--- .../templates/settings_system/files.html | 59 +++++++--- .../templates/settings_system/settings.html | 110 +++++++++++++++--- dashmachine/templates/user/login.html | 6 +- dashmachine/user_system/forms.py | 63 +--------- dashmachine/user_system/routes.py | 17 ++- dashmachine/version.py | 2 +- manage_db.py | 6 +- migrations/env.py | 22 ++-- run.py | 2 +- 22 files changed, 275 insertions(+), 246 deletions(-) create mode 100644 app_templates.ini delete mode 100644 dashmachine/dashmachine_init.py create mode 120000 dashmachine/static/images/icons diff --git a/app_templates.ini b/app_templates.ini new file mode 100644 index 0000000..f23de31 --- /dev/null +++ b/app_templates.ini @@ -0,0 +1,6 @@ +[Nextcloud] +prefix = https:// +url = your-website.com +icon = static/images/apps/nextcloud.png +description = A safe home for all your data – community-driven, free & open source +open_in = this_tab diff --git a/dashmachine/dashmachine_init.py b/dashmachine/dashmachine_init.py deleted file mode 100644 index 08c9c50..0000000 --- a/dashmachine/dashmachine_init.py +++ /dev/null @@ -1,30 +0,0 @@ -import os -from shutil import copyfile -from dashmachine.paths import dashmachine_folder, images_folder -from dashmachine.main.utils import read_config -from dashmachine.user_system.models import User -from dashmachine.user_system.utils import add_edit_user - - -def dashmachine_init(): - user_data_folder = os.path.join(dashmachine_folder, "user_data") - - # create the user_data subdirectories, link them to static - user_backgrounds_folder = os.path.join(user_data_folder, "backgrounds") - if not os.path.isdir(user_backgrounds_folder): - os.mkdir(user_backgrounds_folder) - os.symlink(user_backgrounds_folder, os.path.join(images_folder, "backgrounds")) - - user_icons_folder = os.path.join(user_data_folder, "user_icons") - if not os.path.isdir(user_icons_folder): - os.mkdir(user_icons_folder) - os.symlink(user_icons_folder, os.path.join(images_folder, "user_icons")) - - config_file = os.path.join(user_data_folder, "config.ini") - if not os.path.exists(config_file): - copyfile("default_config.ini", config_file) - read_config() - - user = User.query.first() - if not user: - add_edit_user(username="admin", password="admin") diff --git a/dashmachine/error_pages/routes.py b/dashmachine/error_pages/routes.py index 861f19d..10e4eb9 100755 --- a/dashmachine/error_pages/routes.py +++ b/dashmachine/error_pages/routes.py @@ -1,6 +1,6 @@ from flask import Blueprint, render_template -error_pages = Blueprint('error_pages', __name__) +error_pages = Blueprint("error_pages", __name__) # ------------------------------------------------------------------------------ @@ -8,14 +8,14 @@ error_pages = Blueprint('error_pages', __name__) # ------------------------------------------------------------------------------ @error_pages.app_errorhandler(404) def error_404(error): - return render_template('/error_pages/404.html'), 404 + return render_template("/error_pages/404.html"), 404 @error_pages.app_errorhandler(403) def error_403(error): - return render_template('/error_pages/403.html'), 403 + return render_template("/error_pages/403.html"), 403 @error_pages.app_errorhandler(500) def error_500(error): - return render_template('/error_pages/500.html'), 500 + return render_template("/error_pages/500.html"), 500 diff --git a/dashmachine/main/utils.py b/dashmachine/main/utils.py index dec7bb3..d62a0e5 100755 --- a/dashmachine/main/utils.py +++ b/dashmachine/main/utils.py @@ -1,6 +1,12 @@ +import os +from shutil import copyfile from configparser import ConfigParser + +from dashmachine.paths import dashmachine_folder, images_folder from dashmachine.main.models import Apps from dashmachine.settings_system.models import Settings +from dashmachine.user_system.models import User +from dashmachine.user_system.utils import add_edit_user from dashmachine import db @@ -77,3 +83,27 @@ def read_config(): def public_route(decorated_function): decorated_function.is_public = True return decorated_function + + +def dashmachine_init(): + user_data_folder = os.path.join(dashmachine_folder, "user_data") + + # create the user_data subdirectories, link them to static + user_backgrounds_folder = os.path.join(user_data_folder, "backgrounds") + if not os.path.isdir(user_backgrounds_folder): + os.mkdir(user_backgrounds_folder) + os.symlink(user_backgrounds_folder, os.path.join(images_folder, "backgrounds")) + + icons_folder = os.path.join(user_data_folder, "icons") + if not os.path.isdir(icons_folder): + os.mkdir(icons_folder) + os.symlink(icons_folder, os.path.join(images_folder, "icons")) + + config_file = os.path.join(user_data_folder, "config.ini") + if not os.path.exists(config_file): + copyfile("default_config.ini", config_file) + read_config() + + user = User.query.first() + if not user: + add_edit_user(username="admin", password="admin") \ No newline at end of file diff --git a/dashmachine/paths.py b/dashmachine/paths.py index a84f302..7397a4f 100755 --- a/dashmachine/paths.py +++ b/dashmachine/paths.py @@ -21,6 +21,8 @@ apps_images_folder = os.path.join(images_folder, "apps") backgrounds_images_folder = os.path.join(images_folder, "backgrounds") +icons_images_folder = os.path.join(images_folder, "icons") + cache_folder = os.path.join(static_folder, "cache") user_images_folder = os.path.join(images_folder, "user") diff --git a/dashmachine/rest_api/resources.py b/dashmachine/rest_api/resources.py index d7b5da5..0bad2d9 100755 --- a/dashmachine/rest_api/resources.py +++ b/dashmachine/rest_api/resources.py @@ -6,16 +6,16 @@ from dashmachine.version import tcmachine_version class GetVersion(Resource): def get(self): - return {'Version': tcmachine_version} + return {"Version": tcmachine_version} class ServerShutdown(Resource): def get(self): - os.system('shutdown now') - return {'Done'} + os.system("shutdown now") + return {"Done"} class ServerReboot(Resource): def get(self): - os.system('reboot') - return {'Done'} + os.system("reboot") + return {"Done"} diff --git a/dashmachine/settings_system/routes.py b/dashmachine/settings_system/routes.py index 7d93dfa..b3f4a6e 100644 --- a/dashmachine/settings_system/routes.py +++ b/dashmachine/settings_system/routes.py @@ -1,9 +1,10 @@ import os -from flask import render_template, url_for, redirect, request, Blueprint, jsonify +from flask import render_template, request, Blueprint, jsonify from dashmachine.settings_system.forms import ConfigForm +from dashmachine.user_system.forms import UserForm from dashmachine.main.utils import read_config from dashmachine.main.models import Files -from dashmachine.paths import backgrounds_images_folder, apps_images_folder +from dashmachine.paths import backgrounds_images_folder, icons_images_folder from dashmachine.settings_system.utils import load_files_html settings_system = Blueprint("settings_system", __name__) @@ -12,11 +13,12 @@ settings_system = Blueprint("settings_system", __name__) @settings_system.route("/settings", methods=["GET"]) def settings(): config_form = ConfigForm() + user_form = UserForm() with open("dashmachine/user_data/config.ini", "r") as config_file: config_form.config.data = config_file.read() files_html = load_files_html() return render_template( - "settings_system/settings.html", config_form=config_form, files_html=files_html + "settings_system/settings.html", config_form=config_form, files_html=files_html, user_form=user_form ) @@ -30,8 +32,8 @@ def save_config(): @settings_system.route("/settings/add_images", methods=["POST"]) def add_images(): - if request.form.get("folder") == "apps": - dest_folder = apps_images_folder + if request.form.get("folder") == "icons": + dest_folder = icons_images_folder elif request.form.get("folder") == "backgrounds": dest_folder = backgrounds_images_folder for cached_file in request.form.get("files").split(","): diff --git a/dashmachine/settings_system/utils.py b/dashmachine/settings_system/utils.py index 41b76d9..3ab494e 100644 --- a/dashmachine/settings_system/utils.py +++ b/dashmachine/settings_system/utils.py @@ -1,13 +1,13 @@ -from dashmachine.paths import backgrounds_images_folder, apps_images_folder +from dashmachine.paths import backgrounds_images_folder, icons_images_folder from flask import render_template from os import listdir def load_files_html(): - background_images = listdir(backgrounds_images_folder) - apps_images = listdir(apps_images_folder) + backgrounds = listdir(backgrounds_images_folder) + icons = listdir(icons_images_folder) return render_template( "settings_system/files.html", - background_images=background_images, - apps_images=apps_images, + backgrounds=backgrounds, + icons=icons, ) diff --git a/dashmachine/static/css/global/dashmachine.css b/dashmachine/static/css/global/dashmachine.css index b490bb2..92aad3f 100644 --- a/dashmachine/static/css/global/dashmachine.css +++ b/dashmachine/static/css/global/dashmachine.css @@ -766,11 +766,6 @@ span.badge.new { position: relative; right: 10px; } -.copy-btn { - position: relative; - top: 2px; - font-size: 1.25rem; -} /*FAB*/ .tap-target-wave::before, .tap-target-wave::after { diff --git a/dashmachine/static/images/icons b/dashmachine/static/images/icons new file mode 120000 index 0000000..445c4a8 --- /dev/null +++ b/dashmachine/static/images/icons @@ -0,0 +1 @@ +/home/ross/Dev/DashMachineEnv/DashMachine/dashmachine/user_data/icons \ No newline at end of file diff --git a/dashmachine/static/js/global/dashmachine.js b/dashmachine/static/js/global/dashmachine.js index 8f9a72f..50d9280 100644 --- a/dashmachine/static/js/global/dashmachine.js +++ b/dashmachine/static/js/global/dashmachine.js @@ -170,22 +170,6 @@ function init_autocomplete_chips(){ }); } -function init_send_doc_email_btns(el) { - el.on('click', function() { - let attachment_deal = $("#attachment-deal") - attachment_deal.val($(this).attr('data-deal_id')); - attachment_deal.trigger('change'); - sleep(100).then(() => { - let deal_doc = $("#deal-doc") - deal_doc.val($(this).attr('data-file')); - deal_doc.trigger('change'); - tinymce.get("email-panel-content").setContent($(this).attr('data-signature')); - $("#attachments").removeClass('hide'); - $("#email-panel").removeClass('hide'); - $("#chips-mailto input").trigger('focus'); - }); - }); -} function toggleDarkMode(){ let mode = localStorage.getItem('mode'); @@ -212,9 +196,10 @@ function toggleTooltips(){ } } -function init_copy_btn(){ +function init_copy_btn(parent_class){ $(".copy-btn").on('click', function(e) { - let target_text = $(this).closest('.col').find('.copy-target').text(); + let target_text = $(this).closest(parent_class).find('.copy-target').text(); + console.log(target_text) let copy_input = $("#copy-input"); copy_input.val(target_text); copy_input.removeClass("hide"); @@ -293,49 +278,6 @@ function initCleave(){ }); } -// TinyMCE Editor -function initTinyMCE(el){ - // Check TinyMCE initialized or not - if(tinyMCE.get(el)){ - // Remove instance by id - tinymce.remove('#' + el); - }else{ - let mode = localStorage.getItem('mode'); - let theme = "" - if (mode === 'dark') { - theme = "dark" - } else { - theme = "light" - } - tinymce.init({ - selector: '#' + el, - height: 200, - menubar: false, - removed_menuitems: 'undo, redo, anchor', - skin: theme, - statusbar: true, - branding: false, - paste_data_images: true, - force_br_newlines: true, - force_p_newlines: false, - forced_root_block: '', - content_style: "body {margin-top: 15px}", - visual_table_class: 'no-border', - mode: "exact", - plugins: [ - 'autolink lists link image charmap print preview anchor textcolor', - 'searchreplace visualblocks code fullscreen', - 'insertdatetime media table paste code help imagetools' - ], - toolbar: 'formatselect | bold italic forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent fullscreen code', - content_css: [ - '//fonts.googleapis.com/css?family=Lato:300,300i,400,400i', - '//www.tiny.cloud/css/codepen.min.css' - ] - }); - } -} - function hide_sidenav() { $("#main-sidenav").addClass('hide'); $("#main.main-full").css('padding-left', 0); @@ -361,7 +303,6 @@ $(document).ready(function () { init_timepicker(); initCleave(); init_tooltips(); - init_copy_btn(); init_select(); if (localStorage.getItem('sidenav_hidden') === 'true'){ diff --git a/dashmachine/templates/main/base.html b/dashmachine/templates/main/base.html index bb6ff2e..df5ffe1 100644 --- a/dashmachine/templates/main/base.html +++ b/dashmachine/templates/main/base.html @@ -63,7 +63,9 @@ {% block sidenav %}{% endblock sidenav %} - {% block content %}{% endblock content %} + {% block content %} + + {% endblock content %} {% block footer %}{% endblock footer %} diff --git a/dashmachine/templates/main/home.html b/dashmachine/templates/main/home.html index 04d00d1..4af7890 100755 --- a/dashmachine/templates/main/home.html +++ b/dashmachine/templates/main/home.html @@ -27,27 +27,40 @@
- {% for app in apps %} - {% if app.open_in == 'iframe' %} - - {% elif app.open_in == 'this_tab' %} - - {% elif app.open_in == "new_tab" %} - - {% endif %} -
diff --git a/dashmachine/templates/settings_system/files.html b/dashmachine/templates/settings_system/files.html index 7579f1b..6f2309f 100644 --- a/dashmachine/templates/settings_system/files.html +++ b/dashmachine/templates/settings_system/files.html @@ -1,15 +1,29 @@ + +
  • Backgrounds
  • - {% for background_image in background_images %} -
  • static/images/backgrounds/{{ background_image }} - close - filter_none - visibility -
  • - {% endfor %} + {% if backgrounds %} + {% for background in backgrounds %} +
  • + + + + static/images/backgrounds/{{ background }} + close + filter_none +
  • + {% endfor %} + {% else %} +
  • No files yet
  • + {% endif %}
@@ -17,14 +31,27 @@
    -
  • Apps
  • - {% for apps_image in apps_images %} -
  • static/images/apps/{{ apps_image }} - close - filter_none - visibility -
  • - {% endfor %} +
  • Icons
  • + {% if icons %} + {% for icon in icons %} +
  • + + + + static/images/icons/{{ icon }} + close + filter_none +
  • + {% endfor %} + {% else %} +
  • No files yet
  • + {% endif %}
-
\ No newline at end of file + + + \ No newline at end of file diff --git a/dashmachine/templates/settings_system/settings.html b/dashmachine/templates/settings_system/settings.html index 61cd15c..2401ebc 100644 --- a/dashmachine/templates/settings_system/settings.html +++ b/dashmachine/templates/settings_system/settings.html @@ -48,32 +48,42 @@ [Settings]
theme = dark
accent = orange
- accent = static/images/backgrounds/background.png
+ background = static/images/backgrounds/background.png
- + + + - + + + - + + + - + + + - + + +
VariableValueRequiredDescriptionOptions
[Settings]config section name. required.YesConfig section name.string
themeUI theme, options are light, darkYesUI themelight, dark
accentUI accent, options are orange, green, blue, green, pink, greyYesUI accent colororange, green, blue, green, pink, grey
backgroundBackground image. can be either a local link (prefixed by /static/images/backgrounds/) or an external link. Can also be set to random. If not set defaults to blank.YesBackground image for the UI/static/images/backgrounds/yourpicture.png, external link to image, None, random
@@ -93,37 +103,53 @@ Variable - Value + Required + Description + Options [App Name] + Yes The name of your app. + string prefix - the prefix for the app's url, e.g. http:// or https:// + Yes + The prefix for the app's url. + web prefix, e.g. http:// or https:// url - the url for your app, e.g. google.com + Yes + The url for your app. + web url, e.g. myapp.com icon - icon for the dashboard, can be either a local link (prefixed by /static/images/apps/), or an external link + No + Icon for the dashboard. + /static/images/icons/yourpicture.png, external link to image sidebar_icon - icon for the sidebar, can be either a local link (prefixed by /static/images/apps/), or an external link + No + Icon for the sidenav. + /static/images/icons/yourpicture.png, external link to image description - a short description for the app + No + A short description for the app. + string open_in - open the app in the current tab, an iframe or a new tab, options are iframe, new_tab, or this_tab + Yes + open the app in the current tab, an iframe or a new tab + iframe, new_tab, this_tab @@ -146,20 +172,74 @@
+
+
+
User
+ {{ user_form.hidden_tag() }} + + {{ input( + label="Username", + id="user-form-username", + size="s12", + form_obj=user_form.username, + val=current_user.username + ) }} + + {{ input( + label="Password", + id="user-form-password", + form_obj=user_form.password, + size="s12" + ) }} + + {{ input( + label="Confirm Password", + id="user-form-confirm_password", + form_obj=user_form.confirm_password, + required='required', + size="s12" + ) }} + + {{ button( + icon="save", + float="left", + text="save" + ) }} +
+
+ +
+ +
+
+
App Templates
+
+
+ + search + + +
+
+
+
+ +
+
Images
- {{ tcdrop(allowed_types='jpg,jpeg,png', id="images-tcdrop", max_files="30") }} + {{ tcdrop(allowed_types='jpg,jpeg,png,gif', id="images-tcdrop", max_files="30") }} {{ button(text="save", icon="save", id="save-images-btn", float="left", data={"url": url_for('settings_system.add_images')}) }}
diff --git a/dashmachine/templates/user/login.html b/dashmachine/templates/user/login.html index 6d681d4..9d4659a 100644 --- a/dashmachine/templates/user/login.html +++ b/dashmachine/templates/user/login.html @@ -49,9 +49,9 @@ {{ form.hidden_tag() }}
- mail_outline - {{ form.email(class="validate", id="email", type="text") }} - + person + {{ form.username(class="validate", id="username", type="text") }} +
diff --git a/dashmachine/user_system/forms.py b/dashmachine/user_system/forms.py index 2f6f5f7..02d0b52 100755 --- a/dashmachine/user_system/forms.py +++ b/dashmachine/user_system/forms.py @@ -1,68 +1,17 @@ from flask_wtf import FlaskForm -from flask_login import current_user from wtforms import ( StringField, PasswordField, - SubmitField, BooleanField, - SelectField, - FileField, ) -from wtforms.validators import DataRequired, EqualTo, Email, Length, ValidationError -from dashmachine.user_system.models import User +from wtforms.validators import DataRequired -class PasswordForm(FlaskForm): - password = PasswordField( - "Password", - validators=[ - DataRequired(), - Length(min=8, message="Password must be at least 8 characters."), - EqualTo("confirm_password", message="Passwords must match."), - ], - ) +class UserForm(FlaskForm): + username = StringField(validators=[DataRequired()]) - confirm_password = PasswordField("Confirm Password", validators=[DataRequired()]) + password = PasswordField(validators=[DataRequired()]) + confirm_password = PasswordField() -class RegisterForm(FlaskForm): - email = StringField("Email", validators=[DataRequired(), Email()]) - - def validate_email(form, field): - if field.data == current_user.email: - email_in_db = None - else: - email_in_db = User.query.filter_by(email=field.data).first() - if email_in_db: - raise ValidationError("Email is already registered.") - - fname = StringField("First Name", validators=[DataRequired()]) - - lname = StringField("Last Name", validators=[DataRequired()]) - - phone = StringField("Phone Number", validators=[DataRequired()]) - - company = StringField("Company/Team Name") - - avatar = FileField() - - password = PasswordField( - "Password", - validators=[ - DataRequired(), - Length(min=8, message="Password must be at least 8 characters."), - EqualTo("confirm_password", message="Passwords must match."), - ], - ) - - confirm_password = PasswordField("Confirm Password", validators=[DataRequired()]) - - -class LoginForm(FlaskForm): - email = StringField("User Name", validators=[DataRequired()]) - - password = PasswordField("Password", validators=[DataRequired()]) - - submit = SubmitField() - - remember = BooleanField("Remember Me") + remember = BooleanField() diff --git a/dashmachine/user_system/routes.py b/dashmachine/user_system/routes.py index 32d46c3..498015f 100755 --- a/dashmachine/user_system/routes.py +++ b/dashmachine/user_system/routes.py @@ -1,7 +1,8 @@ from flask import render_template, url_for, redirect, Blueprint from flask_login import login_user, logout_user, current_user -from dashmachine.user_system.forms import LoginForm +from dashmachine.user_system.forms import UserForm from dashmachine.user_system.models import User +from dashmachine.user_system.utils import add_edit_user from dashmachine import bcrypt from dashmachine.main.utils import public_route @@ -20,10 +21,10 @@ def login(): if current_user.is_authenticated: return redirect(url_for("main.home")) - form = LoginForm() + form = UserForm() if form.validate_on_submit(): - user = User.query.filter_by(username=form.email.data.lower()).first() + user = User.query.filter_by(username=form.username.data.lower()).first() if user and bcrypt.check_password_hash(user.password, form.password.data): login_user(user, remember=form.remember.data) @@ -43,3 +44,13 @@ def logout(): logout_user() return redirect(url_for("user_system.login")) + + +@user_system.route("/edit_user", methods=["POST"]) +def edit_user(): + form = UserForm() + + if form.validate_on_submit(): + add_edit_user(username=form.username.data, password=form.password.data) + + return 'ok' \ No newline at end of file diff --git a/dashmachine/version.py b/dashmachine/version.py index 1f010b9..e1191cc 100755 --- a/dashmachine/version.py +++ b/dashmachine/version.py @@ -1 +1 @@ -tcmachine_version = 'v0.0' +tcmachine_version = "v0.0" diff --git a/manage_db.py b/manage_db.py index 49fb10a..20c0153 100755 --- a/manage_db.py +++ b/manage_db.py @@ -4,12 +4,12 @@ from flask_script import Manager from flask_migrate import Migrate, MigrateCommand from dashmachine import app, db -app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///dashmachine/site.db' +app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///dashmachine/site.db" migrate = Migrate(app, db) manager = Manager(app) -manager.add_command('db', MigrateCommand) +manager.add_command("db", MigrateCommand) -if __name__ == '__main__': +if __name__ == "__main__": manager.run() diff --git a/migrations/env.py b/migrations/env.py index 79b8174..d766af8 100644 --- a/migrations/env.py +++ b/migrations/env.py @@ -15,17 +15,19 @@ config = context.config # Interpret the config file for Python logging. # This line sets up loggers basically. fileConfig(config.config_file_name) -logger = logging.getLogger('alembic.env') +logger = logging.getLogger("alembic.env") # add your model's MetaData object here # for 'autogenerate' support # from myapp import mymodel # target_metadata = mymodel.Base.metadata from flask import current_app + config.set_main_option( - 'sqlalchemy.url', current_app.config.get( - 'SQLALCHEMY_DATABASE_URI').replace('%', '%%')) -target_metadata = current_app.extensions['migrate'].db.metadata + "sqlalchemy.url", + current_app.config.get("SQLALCHEMY_DATABASE_URI").replace("%", "%%"), +) +target_metadata = current_app.extensions["migrate"].db.metadata # other values from the config, defined by the needs of env.py, # can be acquired: @@ -46,9 +48,7 @@ def run_migrations_offline(): """ url = config.get_main_option("sqlalchemy.url") - context.configure( - url=url, target_metadata=target_metadata, literal_binds=True - ) + context.configure(url=url, target_metadata=target_metadata, literal_binds=True) with context.begin_transaction(): context.run_migrations() @@ -66,15 +66,15 @@ def run_migrations_online(): # when there are no changes to the schema # reference: http://alembic.zzzcomputing.com/en/latest/cookbook.html def process_revision_directives(context, revision, directives): - if getattr(config.cmd_opts, 'autogenerate', False): + if getattr(config.cmd_opts, "autogenerate", False): script = directives[0] if script.upgrade_ops.is_empty(): directives[:] = [] - logger.info('No changes in schema detected.') + logger.info("No changes in schema detected.") connectable = engine_from_config( config.get_section(config.config_ini_section), - prefix='sqlalchemy.', + prefix="sqlalchemy.", poolclass=pool.NullPool, ) @@ -83,7 +83,7 @@ def run_migrations_online(): connection=connection, target_metadata=target_metadata, process_revision_directives=process_revision_directives, - **current_app.extensions['migrate'].configure_args + **current_app.extensions["migrate"].configure_args ) with context.begin_transaction(): diff --git a/run.py b/run.py index e8bfddd..ae40883 100755 --- a/run.py +++ b/run.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 from dashmachine import app -from dashmachine.dashmachine_init import dashmachine_init +from dashmachine.main.utils import dashmachine_init dashmachine_init()