#!/usr/bin/env python3 from flask import Flask, render_template, request, redirect, url_for from dotenv import load_dotenv import signal import threading import os import threading load_dotenv() app = Flask(__name__, template_folder='./conf/templates') filename = os.environ.get("NUMBERS_FILENAME") port = os.environ.get("PORT") @app.route("/") def index(): return render_template("index.html",) @app.route("/sender", methods=['POST']) def send_form(): if request.method == 'POST': text = request.form.get("message") contacts = data.get_phone_numbers(filename) thread = threading.Thread(target=signal.send, args=(contacts, text)) thread.start() return redirect(url_for("index") + "?notice=Odesláno") app.run(host="0.0.0.0", port=8080)