I don't like to use "magic things" so i don't use django and like
werkzeug a lot. But i like the django project/app strucutre and i'm
trying to emulate this with werkzeug, with some modification because
my app can have something like project/module/app. So, for now, i'm
using the decorator in views to avoid a central place instead of a
urls.py per module, because i don't know how to do this yet. To import
all views (to allow expose method to fill my url_map) and avoid to
much import lines i'm using this code:

def find_and_import(arg, dirname, fnames):
    for file_name in fnames:
        module_name = os.path.join(dirname, arg)[2:].replace('/', '.')
        if file_name == arg + '.py' and not module_name in
sys.modules:
            __import__(module_name)
            break

os.path.walk('./myproject', find_and_import, 'views')

Now, i will build a templates path list to use with  FileSystemLoader
to allow me to structure my app like:

project/module/app/templates
project/module/app/views.py
project/module/app/models.py

project/module/app2/templates
project/module/app2/views.py
project/module/app2/models.py

project/module2/app/templates
project/module2/app/views.py
project/module2/app/models.py

project/app/templates
project/app/views.py
project/app/models.py

I'm in the right direction or there is a simple way to simulate django
project structure ?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pocoo-libs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pocoo-libs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to