[CentralOH] Dynamic Importing
John Santiago
jdsantiagojr at gmail.com
Fri Mar 15 02:37:10 CET 2013
Hi all,
I have been working on some Flask projects, and was trying to do some
Dyanic importing for the Blueprint Modules. I didn't like all the import
statements. . .
blueprints = ['frontend', 'admin']
for path in blueprints:
mod = __import__('controllers.%s' % path, fromlist=[path])
app.register_blueprint(mod)
I also initial tried os.walk and using exec 'import statement'. but didn;t
feel right. Has anyone else done something similar to this?
--
This electronic message is intended to be for the use only of the named
recipient, and may contain information that is confidential or privileged.
If you are not the intended recipient, you are hereby notified that any
disclosure, copying, distribution or use of the contents of this message is
strictly prohibited. If you have received this message in error or are not
the named recipient, please notify us immediately by contacting the sender
at the electronic mail address noted above, and delete and destroy all
copies of this message. Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/centraloh/attachments/20130314/6f765716/attachment.html>
More information about the CentralOH
mailing list