Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding a cache_bust manage command

it makes a build.py that lets us use BUILD_ID for assets, taken from 
jingo_minify (since currently i only need the BUILD_ID)
  • Loading branch information...
commit 44439a07312c4ed4f7dcf96a2bccf392fe4d9bcd 1 parent 6417482
@seanmonstar seanmonstar authored
View
2  .gitignore
@@ -1,5 +1,7 @@
adminmedia
build
+build.py
+ide-min.js
flightdeckenv
flightdeck/media/jetpack
flightdeck/media/tutorial
View
0  apps/base/management/__init__.py
No changes.
View
0  apps/base/management/commands/__init__.py
No changes.
View
20 apps/base/management/commands/cache_bust.py
@@ -0,0 +1,20 @@
+import os
+import time
+
+from django.core.management.base import BaseCommand
+from django.conf import settings
+
+class Command(BaseCommand):
+ """
+ Updates build.py with a new BUILD_ID that can be used for assets.
+ """
+
+ def handle(self, *args, **kwargs):
+ build_id = hex(int(time.time()))[2:]
+
+ build_id_file = os.path.realpath(os.path.join(settings.ROOT,
+ 'build.py'))
+
+ with open(build_id_file, 'w') as f:
+ f.write('BUILD_ID = "%s"' % build_id)
+ f.write('\n')
Please sign in to comment.
Something went wrong with that request. Please try again.