Browse Source

Read sandbox cache settings from CACHE_URL

This allows the latest.oscarcommerce.com to run with memcache
master
Michael van Tellingen 8 years ago
parent
commit
f16b573eb2
No account linked to committer's email address
3 changed files with 11 additions and 7 deletions
  1. 1
    0
      .dockerignore
  2. 2
    0
      requirements.txt
  3. 8
    7
      sandbox/settings.py

+ 1
- 0
.dockerignore View File

4
 __pycache__
4
 __pycache__
5
 *.pyc
5
 *.pyc
6
 node_modules/
6
 node_modules/
7
+sandbox/public/

+ 2
- 0
requirements.txt View File

3
 #
3
 #
4
 # $ for x in `yolk -l | awk '{print $1}'`; do yolk -d $x 2>/dev/null; done
4
 # $ for x in `yolk -l | awk '{print $1}'`; do yolk -d $x 2>/dev/null; done
5
 # Development
5
 # Development
6
+django-environ==0.4.1
6
 django-debug-toolbar==1.6
7
 django-debug-toolbar==1.6
7
 django-extensions==1.7.6
8
 django-extensions==1.7.6
9
+python-memcached==1.58
8
 Werkzeug==0.11.15
10
 Werkzeug==0.11.15
9
 
11
 
10
 # Sandbox
12
 # Sandbox

+ 8
- 7
sandbox/settings.py View File

1
 import os
1
 import os
2
-
2
+import environ
3
 import oscar
3
 import oscar
4
 
4
 
5
+env = environ.Env()
6
+
5
 # Path helper
7
 # Path helper
6
 location = lambda x: os.path.join(
8
 location = lambda x: os.path.join(
7
     os.path.dirname(os.path.realpath(__file__)), x)
9
     os.path.dirname(os.path.realpath(__file__)), x)
8
 
10
 
9
-DEBUG = os.environ.get('DEBUG', 'true') != 'false'
11
+DEBUG = env.bool('DEBUG', default=True)
10
 SQL_DEBUG = DEBUG
12
 SQL_DEBUG = DEBUG
11
 
13
 
12
 ALLOWED_HOSTS = [
14
 ALLOWED_HOSTS = [
39
 }
41
 }
40
 
42
 
41
 CACHES = {
43
 CACHES = {
42
-    'default': {
43
-        'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
44
-    }
44
+    'default': env.cache(default='locmemcache://'),
45
 }
45
 }
46
 
46
 
47
+
47
 # Local time zone for this installation. Choices can be found here:
48
 # Local time zone for this installation. Choices can be found here:
48
 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
49
 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
49
 # although not all choices may be available on all operating systems.
50
 # although not all choices may be available on all operating systems.
391
 # Sentry
392
 # Sentry
392
 # ======
393
 # ======
393
 
394
 
394
-if os.environ.get('SENTRY_DSN'):
395
-    RAVEN_CONFIG = {'dsn': os.environ.get('SENTRY_DSN')}
395
+if env('SENTRY_DSN', default=None):
396
+    RAVEN_CONFIG = {'dsn': env('SENTRY_DSN', default=None)}
396
     LOGGING['handlers']['sentry'] = {
397
     LOGGING['handlers']['sentry'] = {
397
         'level': 'ERROR',
398
         'level': 'ERROR',
398
         'class': 'raven.contrib.django.raven_compat.handlers.SentryHandler',
399
         'class': 'raven.contrib.django.raven_compat.handlers.SentryHandler',

Loading…
Cancel
Save