|
|
|
@ -1,7 +1,8 @@
|
|
|
|
|
import json
|
|
|
|
|
import click
|
|
|
|
|
from datetime import datetime, timedelta
|
|
|
|
|
from random import choice
|
|
|
|
|
from os import makedirs
|
|
|
|
|
from os import makedirs, path, remove
|
|
|
|
|
from flask import Flask, request, session, redirect
|
|
|
|
|
from flask import render_template, flash, url_for
|
|
|
|
|
from flask_session import Session
|
|
|
|
@ -103,5 +104,15 @@ def payout_users():
|
|
|
|
|
sweep = wallet.sweep_all(account=post.account_index, dest_address=submitter.address)
|
|
|
|
|
print(sweep)
|
|
|
|
|
|
|
|
|
|
@app.cli.command("delete_post")
|
|
|
|
|
@click.argument("post_id")
|
|
|
|
|
def delete_post(post_id):
|
|
|
|
|
post = Post.get(id=post_id)
|
|
|
|
|
save_path_base = path.join(app.config["DATA_FOLDER"], "uploads")
|
|
|
|
|
save_path = path.join(save_path_base, post.image_name)
|
|
|
|
|
post.delete_instance()
|
|
|
|
|
remove(save_path)
|
|
|
|
|
print(f"Deleted post {post_id} and image {save_path}")
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
app.run()
|
|
|
|
|