Merge branch 'master' of github.com:liangliangyy/DjangoBlog

sh_branch
liangliangyy 9 years ago
commit dd2245dc63

@ -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',
}

@ -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

@ -54,7 +54,7 @@
<h2 class="site-description">{{ SITE_DESCRIPTION }}</h2>
</hgroup>
{% cache 36000 sidebar %}
{% cache 36000 nav %}
{% include 'share_layout/nav.html' %}
{% endcache %}
@ -63,7 +63,7 @@
{% block content %}
{% endblock %}
{% cache 36000 nav %}
{% cache 36000 sidebar %}
{% block sidebar %}
{% endblock %}

Loading…
Cancel
Save