Dash app reloads after error


I am facing an issue where the Dash app encounters an error and then, instead of stopping and exiting, it restarts the program once and fails again. It waits indefinitely after this:

2020-05-26 15:31:57 PM INFO ********** PROCESS START **********
2020-05-26 15:32:01 PM ERROR Error: SQL error
2020-05-26 15:32:03 PM INFO ********** PROCESS START **********
2020-05-26 15:32:04 PM ERROR Error: SQL error

This is the part of the code that is being called inside the Dash app:

    pyodbc.pooling = False
    with pyodbc.connect(connection, autocommit=True) as conn:
        conn.setdecoding(pyodbc.SQL_CHAR, encoding='utf-8')
        conn.setdecoding(pyodbc.SQL_WCHAR, encoding='utf-8')
            df_help = pd.read_sql(sql_col_list, conn, index_col = 'ColumnName',parse_dates=['CreateTimeStamp', 'LastAlterTimeStamp'])
            df_counts = pd.read_sql(pull_header_counts(df_help), conn)
            logging.error('Error: SQL error')

Even though I have given sys.exit() it does not exit the execution. It starts the execution all over again and then fails again. Then it hangs (waits indefinitely).

This is happening even though I have mentioned use_reloader = False and debug=False but to no avail:

app.layout = app_layout()
if name == ‘main’:
app.run_server(debug=False, use_reloader=False, port=8080)

Could you tell me how to avoid restarting the program?

Troubleshooting Checklist
Verify that you can deploy an app in the App Catalog. These apps are supplied by Plotly and come with all the files required for deployment, which often allows you to eliminate app files as the cause of your issue.
Check that your app contains a Procfile and a requirements.txt (pip) or environment.yml (Conda). Learn more about required files.
Try running your app in a workspace.
Try deploying your app from a workspace. In Workspaces, Git and SSH are preconfigured, which often allows you to eliminate Git and SSH configurations as the cause of your issue.
Find the error message in your terminal, build logs, or app logs. Search for this error message on this page and follow the resolution steps.
Reach out to support team with the error that you encountered.

Rachel Gomez