"""
This is the entry point for the app
"""

import os
from app import create_app
from app.models.shopping import db

# settings.py
from dotenv import load_dotenv
from pathlib import Path  # python3 only

try:
    env_path = str(Path('../.env').resolve())
    load_dotenv(dotenv_path=env_path)
except Exception as exp:
    print(str(exp))

config_name = os.getenv('APP_SETTINGS') or 'development'
app = create_app(config_name)

with app.app_context():
    db.create_all()

if __name__ == '__main__':
    app.run()