Mercurial > public > bravenewsurf
view bns_website/apache/bns.wsgi @ 41:9ce9f77d6cde
I added a get_absolute_url() to the news model so I can use that in the news template tag to create a link to the correct anchor on the news list page.
The link works, but for some reason it goes to the beginning of the article content and not to the title. I've played around with the article tag and making an aside tag with an id and for whatever reason it always goes to the article content.
author | Bob Mourlam <bob.mourlam@gmail.com> |
---|---|
date | Sun, 06 Nov 2011 22:13:27 -0600 |
parents | a5e8741452a3 |
children | f00199f1524c |
line wrap: on
line source
import os import sys OFFLINE = False here = os.path.dirname(__file__) website = os.path.dirname(here) repo = os.path.dirname(website) project = os.path.dirname(repo) eggs = os.path.join(project, 'eggs') django = os.path.join(project, 'django') sys.path.extend([repo, website, django]) os.environ['PYTHON_EGG_CACHE'] = eggs def offline_handler(environ, start_response): """ This handler is run when the site is in maintenance mode. It either displays a brief outage message, or, if a template file exists, it reads the file and returns its contents. """ wsgi_dir = os.path.dirname(__file__) sys.path.append(wsgi_dir) offline_file = os.path.abspath( os.path.join(wsgi_dir, '..', 'templates', 'offline.html')) if os.path.exists(offline_file): response_headers = [('Content-type','text/html')] response = open(offline_file).read() else: response_headers = [('Content-type','text/plain')] response = ('Brave New Surf website maintenance in progress; ' 'please check back soon.') if environ['REQUEST_METHOD'] == 'GET': status = '503 Service Unavailable' else: status = '405 Method Not Allowed' start_response(status, response_headers) return [response] if not OFFLINE: os.environ['DJANGO_SETTINGS_MODULE'] = 'bns_website.settings.production' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler() else: application = offline_handler