Skip to content

Commit dd2245d

Browse files
author
liangliangyy
committed
Merge branch 'master' of github.com:liangliangyy/DjangoBlog
2 parents 0d5619a + 7a6f44a commit dd2245d

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

DjangoBlog/settings.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
# SECURITY WARNING: don't run with debug turned on in production!
2525
# DEBUG = True
26-
DEBUG = True
26+
DEBUG = False
2727

2828
# ALLOWED_HOSTS = []
2929
ALLOWED_HOSTS = ['www.lylinux.net', '127.0.0.1']
@@ -179,11 +179,11 @@
179179
# cache setting
180180

181181
CACHES = {
182-
'default': {
182+
'default1': {
183183
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
184184
'LOCATION': '127.0.0.1:11211',
185185
},
186-
'localmem': {
186+
'default': {
187187
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
188188
'LOCATION': 'unique-snowflake',
189189
}

blog/middleware.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,17 @@ def process_view(self, request, view_func, view_args, view_kwargs):
3131
return
3232

3333
online_ips = cache.get("online_ips", [])
34-
3534
if online_ips:
3635
online_ips = cache.get_many(online_ips).keys()
37-
36+
online_ips = list(online_ips)
3837
ip = get_real_ip(request)
3938

4039
cache.set(ip, 0, 5 * 60)
4140

4241
if ip not in online_ips:
4342
online_ips.append(ip)
44-
45-
cache.set("online_ips", online_ips)
43+
s = type(online_ips)
44+
cache.set("online_ips", online_ips)
4645

4746
def process_response(self, request, response):
4847
cast_time = time.time() - self.start_time

templates/share_layout/base.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ <h1 class="site-title"><a href="{{ SITE_BASE_URL }}" title="{{ SITE_NAME }}" rel
5454
<h2 class="site-description">{{ SITE_DESCRIPTION }}</h2>
5555
</hgroup>
5656

57-
{% cache 36000 sidebar %}
57+
{% cache 36000 nav %}
5858
{% include 'share_layout/nav.html' %}
5959
{% endcache %}
6060

@@ -63,7 +63,7 @@ <h2 class="site-description">{{ SITE_DESCRIPTION }}</h2>
6363
{% block content %}
6464
{% endblock %}
6565

66-
{% cache 36000 nav %}
66+
{% cache 36000 sidebar %}
6767
{% block sidebar %}
6868

6969
{% endblock %}

0 commit comments

Comments
 (0)