I've tried this before, but it doesn't work for my structure. All handlers are in views.py, but in views.py, can't import session then.
On 1月4日, 下午6时18分, Branko Vukelic <[email protected]> wrote: > You could try the web.ctx solution with a handler: > > http://webpy.org/cookbook/sessions_with_subapp > > > > On Mon, Jan 4, 2010 at 10:50 AM, David Shieh <[email protected]> wrote: > > Hey guys, > > > I used web.py for a while, but it's the first time I use sub app and > > want to use session in sub_app. My app structrue is like this: > > > 1. An app.py file, initialize main app, has a urls, an app, an session > > and the app.run() code. > > 2. A views.py file, contains all classes which deal with requests. > > 3. An admin.py file, a sun app file for admin use. > > 4. An adminviews.py files, contains all classes used for admin. > > > The problem is, I initialize session in app.py file, and in views.py > > file, I can't use > > **from davidblog import session** > > to import session. > > Is there a way to make session a global variable? > > > And also another question, if I have 2 apps, no matter main app or sub > > app, can I have one session for each app? > > > Thanks, > > David > > > -- > > > You received this message because you are subscribed to the Google Groups > > "web.py" 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 > > athttp://groups.google.com/group/webpy?hl=en. > > -- > Branko Vukelić > > http://foxbunny.tumblr.com/http://www.flickr.com/photos/16889...@n04/http://www.twitter.com/foxbunny -- You received this message because you are subscribed to the Google Groups "web.py" 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/webpy?hl=en.
