Forums

Flask app main function is not called

This is my app.py main function. It does write the new file 'classifier5.pkl' as intended. It worked only one time after I inserted the socket code ('liveconsole' if-statement). I ran other tests which indicate main is not even being called when I restart/reload my website.

  if __name__ == '__main__':
     clf = update_model(db_path=db,
                   model=clf,
                   batch_size=10000)
     pickle.dump(clf, open(os.path.join(cur_dir,
        'pkl_objects', 'classifier5.pkl'), 'wb')
        , protocol=4)
  if 'liveconsole' not in gethostname():
     app.run()

Seems you also posted here. See the reply there.

I couldn't find my other post, and forgot to activate notifications, so there was no way for me to find it again. That's why I posted another.

That link to my other post doesn't redirect anywhere. Did it get deleted?

Ooops, here is the correct link