3rd party Middleareand custom middleware location

3 views
Skip to first unread message

Voltron

unread,
May 7, 2009, 1:22:27 PM5/7/09
to juno-framework
Hi!

Where does one place the middleware files?


Thanks

Andras Biczo

unread,
May 7, 2009, 4:55:50 PM5/7/09
to juno-fr...@googlegroups.com
The actual location of the files should not matter as long as the
middleware callables you specified in your init() call are importable
by the python interpreter running your application. E.g. you can
install the middleware packages or modules either system-wide, in the
same virtualenv as your application or you can place them in the same
directory as your application.

Andras

Voltron

unread,
May 8, 2009, 12:40:57 AM5/8/09
to juno-framework
Thnsks Andras, since there are no docs on how to structure a Juno app,
I decided on this:


MyApp/
/middleware
/temlates
/views
/modules
index.py

I could naturally import the middleware modules, but I want to make
sure its done the "Juno" way, what do you sugest?


Thanks

Andras Biczo

unread,
May 8, 2009, 10:27:05 AM5/8/09
to juno-fr...@googlegroups.com
Obviously Brian will be the right person to answer the question
whether there's an "official" suggested place for middleware modules
or not. I personally use a separate virtualenv for each of my
applications and install any 3rd party modules in that virtualenv. If
the application needed a custom one-off middleware I'd simply place it
next to the application code but if you have a couple of these then
creating your middleware/ directory or package for them might also
make sense.

Andras

Brian

unread,
May 11, 2009, 5:44:13 AM5/11/09
to juno-framework
I prefer having mine installed systemwide, as I like the simplicity of
keeping everything in one place, especially if other apps will depend
on them. That said, I have used a setup similar to yours:

app/
main.py
middleware/
__init__.py, etc.
templates/
static/

It lets you treat any middleware like one big package, 'import
middleware.blah', etc, which I find nice.

> there are no docs on how to structure a Juno app

This is because I've tried a couple layouts, haven't found one I loved
as they all seem to work pretty well. I would just find which way
feels best to you and go with it.

-- Brian
Reply all
Reply to author
Forward
0 new messages