Код: Выделить всё
from flask import Flask, render_template
import webbrowser
import threading
import time
import sys
import os
import traceback
def resource_path(relative_path):
if hasattr(sys, "_MEIPASS"):
return os.path.join(sys._MEIPASS, relative_path)
return os.path.join(os.path.abspath("."), relative_path)
app = Flask(__name__, template_folder=resource_path("templates"))
@app.route("/")
def index():
return render_template("index.html")
def open_browser():
time.sleep(2)
webbrowser.open_new("http://127.0.0.1:5000")
if __name__ == "__main__":
threading.Timer(2, open_browser).start()
app.run(host="127.0.0.1", port=5000, debug=False, use_reloader=False)
Код: Выделить всё
Error Calculator
.venv
templates
index.html
Код: Выделить всё
App.pyКод: Выделить всё
test1.pyПодробнее здесь: https://stackoverflow.com/questions/798 ... charm-venv
Мобильная версия