Reputation: 346
I tried to keep my code clean by having each of my view classes within a seperate .py file and then importing the main app file to my view file. However, when I tried to post something to my database, I received this error:
ValueError: signal only works in main thread
I played around with it for a while, and ultimately, I resolved the issue by simply placing the views within my main app.py file.
I was wondering at a very high level if anyone has any idea why this would be the case.
Thanks.
Upvotes: 0
Views: 223
Reputation: 6317
The way how Flask is helping to organize your code better in modules is Blueprints
Here is a simple example of the application which uses blueprints. Using blueprints will reduce your app complexity. But if your app is small and you don't want to use blueprints there, why you don't write your classes in separate files and then just import them and use? Of course some of the code in the question would be helpful :)
Upvotes: 2