2010/1/5 Clodoaldo Neto <[email protected]>:
> 2010/1/4 rnarozniak <[email protected]>:
>> Hello,
>>
>> I am very new to mod_wsgi, and I am trying to get beaker session
>> management to work with a mod_wsgi, embedded apache application. I
>> have a feeling that I am missing something quite fundamental to
>> mod_wsgi.
>>
>> Any help would be greatly appreciated.
>>
>
> Just made a copy and paste of your code.
>
>> in my wsgi application script, i have the following:
>>
>> ##################################################################
>> from beaker.middleware import SessionMiddleware
>>
>> def application(environ, start_response):
>>
>>    response_headers =  [
>>        ('Content-Type', 'text/html'),
>>    ]
>>
>>   session = environ['beaker.session']
>
> The above line is unaligned. It starts with two spaces only.
>
>>
>>    sys.path.append("/home/rnarozniak/webapps/mod_wsgi/htdocs")
>>    import forms
>>
>>    start_response('200 OK', response_headers)
>>
>>    return['test'']
>
> Two closing quotes.
>
> Use a syntax coloring editor and you will catch the most common
> problems. I like Komodo Edit. Not an IDE, just a powerful editor.
>
> I didn't pay attention to anything else. Will have time later in the day.

Add this line:

import sys

Change this:
wsgi_app = SessionMiddleware(application, session_opts)

To:
application = SessionMiddleware(application, session_opts)

Now you have a path problem here:

   sys.path.append("/home/rnarozniak/webapps/mod_wsgi/htdocs")
   import forms

I would place these two lines at the top of the script out of the
application function. It will not solve the problem, just a small
performance and style improvement. There are some threads about path
problems. Search and you will find then.

>
> Regards, Clodoaldo
>
>>
>> session_opts = {
>>    'session.type': 'file',
>>    'session.cookie_expires': 300
>> }
>> wsgi_app = SessionMiddleware(application, session_opts)
>>
>> #################################################################
>>
>> it is failing  on the line: session=environ['breaker.session']
>>
>> breaker does not exist in environ, why?
>>
>> --

--

You received this message because you are subscribed to the Google Groups 
"modwsgi" 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/modwsgi?hl=en.


Reply via email to