import os
import sys
from flask import Flask, render_template

# TODO: use pattern from <NAME> microblog
PACKAGE_PARENT = '..'
SCRIPT_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__))))
sys.path.append(os.path.normpath(os.path.join(SCRIPT_DIR, PACKAGE_PARENT)))
from config import Config


# if the app runs from a pyinstaller-executable files can't be found by the __file__ attribute
# instead, sys._MEIPASS has to be used
if getattr(sys, 'frozen', False):
    template_folder = os.path.join(sys._MEIPASS, 'templates')
    static_folder = os.path.join(sys._MEIPASS, 'static')
    app = Flask(__name__, template_folder=template_folder, static_folder=static_folder)
else:
    app = Flask(__name__)
    
app.config.from_object(Config)


@app.route('/')
def hello_world():
    return render_template('index.html')

if __name__ == "__main__":
    app.run(debug=False)

import os
import sys
from flask import Flask, render_template

# TODO: use pattern from <NAME> microblog
PACKAGE_PARENT = '..'
SCRIPT_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__))))
sys.path.append(os.path.normpath(os.path.join(SCRIPT_DIR, PACKAGE_PARENT)))
from config import Config


# if the app runs from a pyinstaller-executable files can't be found by the __file__ attribute
# instead, sys._MEIPASS has to be used
if getattr(sys, 'frozen', False):
    template_folder = os.path.join(sys._MEIPASS, 'templates')
    static_folder = os.path.join(sys._MEIPASS, 'static')
    app = Flask(__name__, template_folder=template_folder, static_folder=static_folder)
else:
    app = Flask(__name__)
    
app.config.from_object(Config)


@app.route('/')
def hello_world():
    return render_template('index.html')

if __name__ == "__main__":
    app.run(debug=False)

# TODO: use pattern from <NAME> microblog # if the app runs from a pyinstaller-executable files can't be found by the __file__ attribute # instead, sys._MEIPASS has to be used