Khaoz,

I have actually been building a framework like this for the exact same
reason.  Its built on Werkzeug:

http://pypi.python.org/pypi/pysapp

My application sets up the routes in the modules settings.py file
(think Django 'app') and then the framework takes care of the rest of
the templating, etc.  I just pushed this project out to pypi two days
ago, so its pretty new.  But I have been working on it for about six
months and have recently pushed out a production website built on it.
If you are interested in taking it for a test drive, follow the
directions on pypi to create your own application.  If nothing else,
the code should give you some good ideas.

Also, there are some really good examples of how to create views (same
concept as Django) in the pysmvt/tests/test_views.py file.  You can
get that file through SVN (checkout the development version link on
pypi).

Feel free to post back with questions.  Since there aren't really any
docs at this point, I am sure you will have a lot.


On Dec 17, 6:31 am, Khaoz <[email protected]> wrote:
> 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