diff --git a/DjangoBlog/settings.py b/DjangoBlog/settings.py index f17dd33..ed94f02 100644 --- a/DjangoBlog/settings.py +++ b/DjangoBlog/settings.py @@ -23,7 +23,7 @@ SECRET_KEY = '&3g0bdza#c%dm1lf%5gi&0-*53p3t0m*hmcvo29cn^$ji7je(c' # SECURITY WARNING: don't run with debug turned on in production! # DEBUG = True -DEBUG = True +DEBUG = False # ALLOWED_HOSTS = [] ALLOWED_HOSTS = ['www.lylinux.net', '127.0.0.1'] @@ -179,11 +179,11 @@ CACHE_CONTROL_MAX_AGE = 2592000 # cache setting CACHES = { - 'default': { + 'default1': { 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', 'LOCATION': '127.0.0.1:11211', }, - 'localmem': { + 'default': { 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', 'LOCATION': 'unique-snowflake', } diff --git a/blog/middleware.py b/blog/middleware.py index dccc53d..b79d432 100644 --- a/blog/middleware.py +++ b/blog/middleware.py @@ -31,18 +31,17 @@ class OnlineMiddleware(object): return online_ips = cache.get("online_ips", []) - if online_ips: online_ips = cache.get_many(online_ips).keys() - + online_ips = list(online_ips) ip = get_real_ip(request) cache.set(ip, 0, 5 * 60) if ip not in online_ips: online_ips.append(ip) - - cache.set("online_ips", online_ips) + s = type(online_ips) + cache.set("online_ips", online_ips) def process_response(self, request, response): cast_time = time.time() - self.start_time diff --git a/templates/share_layout/base.html b/templates/share_layout/base.html index 354d1f9..7db1549 100644 --- a/templates/share_layout/base.html +++ b/templates/share_layout/base.html @@ -54,7 +54,7 @@