On Mon, Jan 4, 2010 at 3:20 PM, 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?
>
Why can't you do "from app import session" in views.py?
> And also another question, if I have 2 apps, no matter main app or sub
> app, can I have one session for each app?
Should be possible. Have you tried something like this?
app1 = web.application(urls, globals())
session1 = web.session.Session(app1, web.session.DiskStore("sessons1"))
app2 = web.applicaiton(urls2, globals())
session2 = web.session.Session(app1, web.session.DiskStore("sessons2"))
--
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.