I’m building a data seeder module that looks for all models using introspection and the inspect module. I index the models I found by a string looking like module.model_name because there might be more modules with the same name in different modules.
The problem is that module sometimes is indeed the right module name, but sometimes it’s __main__, probably because that specific module was the first one that was called to handle a URL after an instance was started. Is there anyway I can avoid this, perhaps by forcing a specific module to always be __main__?
This problems gets worse when I have multiple instances running at once because I also get inconsistent data between instances, each having a different __main__ module.
Thanks
each
scriptentry in yourapp.yamlwill be executed as a__main__module. If you only want a single__main__then you need to run everything through a single entry-point and map everything via a singleWSGIApplicationinstance.