DEV Community

Discussion on: How I Structure My Flask Apps

Collapse
 
adekoder profile image
adekoder

Benefit of using factory methods

Testing. You can have instances of the application with different settings to test every case.

Multiple instances. Imagine you want to run different versions of the same application. Of course you could have multiple instances with different configs set up in your webserver, but if you use factories, you can have multiple instances of the same application running in the same application process which can be handy.

Thread Thread
 
itachiuchiha profile image
Itachi Uchiha

Hmm, can you show an example about factory methods for the newbies :)

Thread Thread
 
adekoder profile image
adekoder

Sure in a bit

Thread Thread
 
itachiuchiha profile image
Itachi Uchiha

Thanks, I'll be waiting for your contribution. Thanks.