Here is a similar question: How to share sessions between modules on a Google App Engine Python application?
I have two modules: default and helloworld
I want all the myapp.appspot.com/helloworld/*
will be routed to the helloworld module.
The dispatch.yaml is as follows:
application: myapp
dispatch:
- url: "*/helloworld/*"
module: helloworld
when I request myapp.appspot.com/helloworld/
, it will be redirected to the login page as I use the @require_login in helloworld.urls.
helloworld.urls:
from django.contrib.auth.decorators import login_required
urlpatterns = patterns('',
url(r'^$', login_required(views.home.as_view()), name='helloworld-home'),
)
However, the login_require is routed to /account/login and is processed by the default module, and the helloworld module can not share the session created by the default module.
Therefore, I will be redirected again to the login page after I login in.
Here is my wsgi.py
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, 'libs'))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myapp.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
The possible solution with webapp2 will pass a config to the wsgi application:
config['webapp2_extras.sessions'] = {
'secret_key': 'my-super-secret-key',
cookie_args': {
'domain' : "yourapp.appspot.com"
}
But I can not find any doc related to django :(
Is it possible to share the session between modules when using django framework in GAE?