Skip to content
This repository has been archived by the owner on Dec 28, 2017. It is now read-only.

added support for local dynamo server #14

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
a07f3e2
added support for local dynamo server
mwaaas Nov 4, 2017
a3f74b8
added option of setting your won config
mwaaas Nov 5, 2017
b808840
Major refactor including:
mwaaas May 10, 2018
ef23cd5
upgrading version.
mwaaas May 10, 2018
6465571
changed the name of the package to avoid collision with the existing …
mwaaas May 10, 2018
7de98b4
fixed a bug manage.py being ignored hence tests failing
mwaaas May 10, 2018
cb7f72a
fixed pickle serializer to work in dynamo session store.
mwaaas May 16, 2018
44287f4
adding option to ignore logging creation and deletion of session store
mwaaas May 16, 2018
c9563aa
Upgrading to new version
mwaaas May 16, 2018
4ca1ad9
fixed to support publishing code.
mwaaas May 16, 2018
78221ea
ignore clear session test, dynamo session store has not yet implement…
mwaaas May 19, 2018
dd3d647
removed unused import
mwaaas May 19, 2018
7b3d2c5
support for ttl
mwaaas May 19, 2018
ee61599
version bump up.
mwaaas May 19, 2018
efc6514
Fixed bug in adding ttl and version bump up.
mwaaas May 20, 2018
e7f0cbc
Adding newrelic metrics.
mwaaas May 22, 2018
f321e60
Logs (#1)
mwaaas May 23, 2018
4c85333
refactored to use proper logging.
mwaaas May 23, 2018
71440d5
version upgrade.
mwaaas May 23, 2018
ca8b180
refactored to reduce the size we are using for reading and writing to…
mwaaas May 23, 2018
f3a437a
Merge branch 'master' of github.com:mwaaas/django-dynamodb-sessions
mwaaas May 23, 2018
1348786
adding custom attribute on requests taking more that 5 milliseconds a…
mwaaas May 24, 2018
412a4d8
version upgrade.
mwaaas May 24, 2018
48b48ba
added metric for retry.
mwaaas May 24, 2018
79e9061
version upgrade.
mwaaas May 24, 2018
9ff7af8
fixed a bug on reporting duration.
mwaaas May 24, 2018
9c500ff
adding session duration in newrelic metrics.
mwaaas May 24, 2018
0ca7681
version upgrade.
mwaaas May 24, 2018
f7e59fd
response analyzing to publish response operation.
mwaaas May 24, 2018
6e18793
monitoring to add amazon request_id.
mwaaas May 24, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: 2
jobs:
build:
machine:
image: circleci/classic:201708-01

working_directory: ~/django-dynamodb-sessions

steps:
- checkout



- run:
name: docker setup
command: |
docker info
docker-compose run --entrypoint='echo "done setting up docker"' app

- run:
name: Running tests
command: |
docker-compose run app ./run_test.sh
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ build
dist
boto
testapp/
manage.py
*.egg-info
.venv
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM python:2.7.13-onbuild

21 changes: 21 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: '2.0'
services:
app:
build: .
depends_on:
- dynamoDb
environment:
- AWS_DEFAULT_REGION=eu-west-1
- LOCAL_DYNAMODB_SERVER=http://dynamoDb:8000
- AWS_ACCESS_KEY_ID=anything
- AWS_SECRET_ACCESS_KEY=anything
volumes:
- ./:/usr/src/app
- ~/.pypirc:/root/.pypirc
command: bash -c "python manage.py test"


dynamoDb:
image: cnadiminti/dynamodb-local:2017-02-16
ports:
- 8789:8000
2 changes: 1 addition & 1 deletion dynamodb_sessions/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__author__ = 'gtaylor'
# Major, minor
__version__ = (0, 7)
__version__ = ('0', '8', '4b10')
11 changes: 6 additions & 5 deletions dynamodb_sessions/backends/cached_dynamodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,24 @@ def __init__(self, session_key=None):

@property
def cache_key(self):
return KEY_PREFIX + self.session_key
return KEY_PREFIX + self._get_or_create_session_key()

def load(self):
data = cache.get(self.cache_key, None)
if data is None:
data = super(SessionStore, self).load()
cache.set(self.cache_key, data, settings.SESSION_COOKIE_AGE)
if self.session_key is not None:
cache.set(self.cache_key, data, self.get_expiry_date())
return data

def exists(self, session_key):
if (KEY_PREFIX + session_key) in cache:
if session_key and (KEY_PREFIX + session_key) in cache:
return True
return super(SessionStore, self).exists(session_key)

def save(self, must_create=False):
super(SessionStore, self).save(must_create)
cache.set(self.cache_key, self._session, settings.SESSION_COOKIE_AGE)
cache.set(self.cache_key, self._session, self.get_expiry_age())

def delete(self, session_key=None):
super(SessionStore, self).delete(session_key)
Expand All @@ -54,4 +55,4 @@ def flush(self):

self.clear()
self.delete(self.session_key)
self.create()
self._session_key = None
Loading