# HG changeset patch # User Brian Neal # Date 1270085977 0 # Node ID db202792d9f5e4e059d497545eb3a847fd8c0e29 # Parent d293b423bdafda18dda7c98e2f16c4c0c8bd1eb6 Explicitly set session settings. Use the cache_db engine. Some minor tweaks to reduce some queries in forums. diff -r d293b423bdaf -r db202792d9f5 gpp/forums/views.py --- a/gpp/forums/views.py Wed Mar 31 01:58:20 2010 +0000 +++ b/gpp/forums/views.py Thu Apr 01 01:39:37 2010 +0000 @@ -19,6 +19,7 @@ from django.template import RequestContext from django.views.decorators.http import require_POST from django.utils.text import wrap +from django.db.models import F from core.paginator import DiggPaginator from core.functions import email_admins @@ -152,13 +153,14 @@ """ Displays all the posts in a topic. """ - topic = get_object_or_404(Topic.objects.select_related(), pk=id) + topic = get_object_or_404(Topic.objects.select_related( + 'forum', 'forum__category', 'last_post'), pk=id) if not topic.forum.category.can_access(request.user): return HttpResponseForbidden() - topic.view_count += 1 - topic.save() + topic.view_count = F('view_count') + 1 + topic.save(force_update=True) posts = topic.posts.select_related() diff -r d293b423bdaf -r db202792d9f5 gpp/settings.py --- a/gpp/settings.py Wed Mar 31 01:58:20 2010 +0000 +++ b/gpp/settings.py Thu Apr 01 01:39:37 2010 +0000 @@ -177,6 +177,19 @@ #CACHE_MIDDLEWARE_ANONYMOUS_ONLY = local_settings.CACHE_MIDDLEWARE_ANONYMOUS_ONLY ####################################################################### +# Sessions +####################################################################### +#SESSION_ENGINE = "django.contrib.sessions.backends.db" +SESSION_ENGINE = "django.contrib.sessions.backends.cached_db" +SESSION_COOKIE_AGE = 2 * 7 * 24 * 60 * 60 # 2 weeks in seconds +SESSION_COOKIE_DOMAIN = None +SESSION_COOKIE_NAME = 'sg101_sessionid' +SESSION_COOKIE_PATH = '/' +SESSION_COOKIE_SECURE = False +SESSION_EXPIRE_AT_BROWSER_CLOSE = False +SESSION_SAVE_EVERY_REQUEST = False + +####################################################################### # Tagging Specific Settings ####################################################################### FORCE_LOWERCASE_TAGS = True