1
Python 2.7とDjango 1.10の2.12.1ライブラリを使用して、Webサービスを使用しています。セッションを使用してクッキーを保存し、永続性を使用し、Webサービスを使用せずに10秒間を渡すと、私のビューはオブジェクト要求を再生成します。セッション...(0123)私の見解がクッキーを変えたからです。なぜ私のリクエストセッションは有効期限ですか?
これは私のViews.pyです:
client_session = requests.Session()
@watch_login
def loginUI(request):
response = client_session.post(URL_API+'login/', data={'username': username, 'password': password,})
json_login = response.json()
@login_required(login_url="/login/")
def home(request):
response_statistics = client_session.get(URL_API+'statistics/')
log('ClientSession: '+str(client_session))
try:
json_statistics = response_statistics.json()
except ValueError:
log('ExcepcionClientSession: '+str(client_session))
return logoutUI(request)
return render(request, "UI/home.html", {
'phone_calls' : json_statistics['phone_calls'],
'mobile_calls' : json_statistics['mobile_calls'],
'other_calls' : json_statistics['other_calls'],
'top_called_phones' : json_statistics['top_called_phones'],
'call_ranges_week' : json_statistics['call_ranges_week'],
'call_ranges_weekend' : json_statistics['call_ranges_weekend'],
'access_data' : accessData(request.user.username),
})
def userFeaturesFormInit(clientRequest):
log('FeaturesClientSession: '+str(client_session))
response = client_session.get(URL_API+'features/')
try:
json_features = response.json()
except ValueError as e:
log('ExcepcionFeaturesClientSession: '+str(client_session))
raise e
ありがとうございました。
あなたはジャンゴを使用していますか? – Marcs
はい、私はdjangoを使用しています。 – ILoveYouDrZaius