File tree Expand file tree Collapse file tree 5 files changed +28
-2
lines changed Expand file tree Collapse file tree 5 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -17,11 +17,14 @@ default: help
1717.state/db-migrated :
1818 # Call migrate target
1919 make migrate
20+ docker compose run --rm web ./manage.py createcachetable
2021
2122 # Mark the state so we don't rebuild this needlessly.
2223 mkdir -p .state && touch .state/db-migrated
2324
2425.state/db-initialized : .state/docker-build-web .state/db-migrated
26+ # Ensure cache table
27+ docker compose run --rm web ./manage.py createcachetable
2528 # Load all fixtures
2629 docker compose run --rm web ./manage.py loaddata fixtures/* .json
2730
Original file line number Diff line number Diff line change 1+ from django .apps import AppConfig
2+
3+
4+ class PyDotOrgConfig (AppConfig ):
5+ name = "pydotorg"
6+
7+ def ready (self ):
8+ import pydotorg .signals # noqa: F401
Original file line number Diff line number Diff line change 208208 'django_countries' ,
209209 'sorl.thumbnail' ,
210210
211+ 'pydotorg' ,
211212 'banners' ,
212213 'blogs' ,
213214 'boxes' ,
Original file line number Diff line number Diff line change 6464
6565CACHES = {
6666 'default' : {
67- 'BACKEND' : 'django.core.cache.backends.locmem.LocMemCache ' ,
68- 'LOCATION' : 'pythondotorg-local-cache ' ,
67+ 'BACKEND' : 'django.core.cache.backends.db.DatabaseCache ' ,
68+ 'LOCATION' : 'django_cache_table ' ,
6969 }
7070}
7171
Original file line number Diff line number Diff line change 1+ from django .db .models .signals import m2m_changed , post_delete , post_save
2+ from django .dispatch import receiver
3+
4+ from sitetree .models import Tree , TreeItem
5+ from sitetree .sitetreeapp import get_sitetree
6+
7+ @receiver (post_save , sender = Tree )
8+ @receiver (post_save , sender = TreeItem )
9+ @receiver (post_delete , sender = TreeItem )
10+ @receiver (m2m_changed , sender = TreeItem .access_permissions )
11+ def purge_sitetree_cache (sender , instance , ** kwargs ):
12+ cache_ = get_sitetree ().cache
13+ cache_ .empty ()
14+ cache_ .reset ()
You can’t perform that action at this time.
0 commit comments