Yes, Anthony. Thanks for taking the efforts to look up poorly issue. I also found the same github thread. It took almost 7 seconds on my server to import plotly in a regular Python console, so it IS the very and only bottleneck!
After all, if I am not supposed to import them, what is the best way? Put import custom module inside a model function? my new idea :) On Monday, February 4, 2019 at 5:28:04 AM UTC-8, Anthony wrote: > > On Monday, February 4, 2019 at 12:58:58 AM UTC-5, Yi Liu wrote: >> >> Thank you for your reply, Dave. If I understand you correctly, I already >> did what you suggested: move those imports into a module file. It did not >> help. >> > > The problem is that you moved the imports to a module, but then you > imported *that *module in your model file, which is equivalent to simply > having all the imports in your model file. Note that model files are > executed on every request (unless you are using the conditional model > functionality), so any imports also happen on every request (including any > imports made by your imported modules). Typically this does not slow things > down on subsequent requests because Python keeps the imported objects in > memory, but in this case it sounds like Plotly also executes some fairly > slow code on import (https://github.com/plotly/plotly.py/issues/740). > > Anthony > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.