MissterHao / django-dysession

django-dysession is a django extension by using AWS DynamoDB as a session backend
MIT License
7 stars 0 forks source link

How to manually set up the DDB #7

Open johnemcbride opened 1 month ago

johnemcbride commented 1 month ago

HI!

I am trying to use the sin the context of a Django app I am running inside lambda and the whole infra is configured through CDK.

As such I am trying to replicate your DDB Table Structure outside of the manage app...

I have set up as follows:

const sessionsTable = new dynamodb.Table(this, "sessions", {
  partitionKey: {
    name: "pk",
    type: dynamodb.AttributeType.STRING,
  },
});

However, I get

An error occurred (ValidationException) when calling the GetItem operation: The provided key element does not match the schema.

My settings:

DYSESSION = { "DYNAMODB_TABLENAME": os.environ['DYNAMODB_SESSIONS_TABLE_NAME'], "TTL_ATTRIBUTE_NAME": "ttl", "CACHE_PERIOD": 3600, "DYNAMODB_REGION": "eu-west-2", "LOGGING": { "TYPE": "CONSOLE", }, }

What am I missing?

johnemcbride commented 1 month ago

The internal error I get is AttributeError: 'SessionStore' object has no attribute '_session_cache'