コード例 #1
0
def file_delete(id_files, filename):
    file = os.path.join(Configs.get_upload_path(), filename)
    if os.path.isfile(file):
        os.remove(file)
    # primeiro deve ser deletado da tabela cross pq no db tem constraints que ligam as primary keys com as
    # foreigns keys, entao o db nao deixa deletar da tabela files enquanto ainda houver ligação com a tabela cross
    DAO.delete_cross_files(id_files)
    DAO.delete(id_files, Files)
    msg = 'Arquivo deletado'
    return msg
コード例 #2
0
from datetime import timedelta

from configs import Configs

CONN_STR = Configs.get_conn_str()
SECRET_KEY = Configs.get_secret_key()
UPLOAD_PATH = Configs.get_upload_path()
SQLALCHEMY_TRACK_MODIFICATIONS = False
SQLALCHEMY_DATABASE_URI = CONN_STR
PERMANENT_SESSION_LIFETIME = timedelta(minutes=60)