Ejemplo n.º 1
0
def config_reload():
    form = ConfigForm(current_app)

    if form.validate_on_submit():
        config = current_app.config["DCON_CONFIG"]
        config["upload_time_now"] = form.upload_time_now.data

        write_config(current_app)
        load_config(current_app)
        flash("Saved and reloaded site configuration!")

    return redirect(url_for("admin.config"))
Ejemplo n.º 2
0
if wd is None:
    wd = os.getcwd()

wd = FilePath(wd)

app.debug = True

# This default should be sufficient to limp along for starters.
app.config["DCON_STATIC_URL"] = "/static/"

app.config["DCON_PATH"] = wd
app.config["DCON_PASSWORD_FILE"] = wd.child("passwords.dcon")
app.config["DCON_UPLOAD_PATH"] = wd.child("uploads")
app.config["SECRET_KEY"] = wd.child("secret.key").open("rb").read()

app.config["UPLOADS_DEFAULT_DEST"] = app.config["DCON_UPLOAD_PATH"].path
app.config["SESSION_PROTECTION"] = None

load_config(app)

configure_uploads(app, (images,))
patch_request_class(app)

db.init_app(app)
lm.setup_app(app)

app.register_blueprint(users)
app.register_blueprint(admin, url_prefix="/admin")
app.register_blueprint(comics)
app.register_blueprint(osuchan, url_prefix="/chan")