diff --git a/src/calibre/www/apps/feedjack/fjlib.py b/src/calibre/www/apps/feedjack/fjlib.py index 555dfe1707..e13fd5e5af 100644 --- a/src/calibre/www/apps/feedjack/fjlib.py +++ b/src/calibre/www/apps/feedjack/fjlib.py @@ -6,7 +6,6 @@ Gustavo Picón fjlib.py """ -from django.conf import settings from django.db import connection from django.core.paginator import Paginator, InvalidPage from django.http import Http404 @@ -125,7 +124,6 @@ def get_extra_content(site, sfeeds_ids, ctx): ctx['feeds'] = [] ctx['last_modified'] = '??' ctx['site'] = site - ctx['media_url'] = settings.MEDIA_URL def get_posts_tags(object_list, sfeeds_obj, user_id, tag_name): """ Adds a qtags property in every post object in a page. diff --git a/src/calibre/www/apps/feedjack/views.py b/src/calibre/www/apps/feedjack/views.py index d87b368a91..c1f31eb908 100644 --- a/src/calibre/www/apps/feedjack/views.py +++ b/src/calibre/www/apps/feedjack/views.py @@ -11,7 +11,7 @@ from django.utils import feedgenerator from django.shortcuts import render_to_response from django.http import HttpResponse from django.utils.cache import patch_vary_headers -from django.template import Context, loader +from django.template import RequestContext, loader from calibre.www.apps.feedjack import models, fjlib, fjcache @@ -58,7 +58,7 @@ def blogroll(request, btype): template = loader.get_template('feedjack/%s.xml' % btype) ctx = {} fjlib.get_extra_content(site, sfeeds_ids, ctx) - ctx = Context(ctx) + ctx = RequestContext(request, ctx) response = HttpResponse(template.render(ctx) , \ mimetype='text/xml; charset=utf-8') @@ -138,7 +138,7 @@ def mainview(request, tag=None, user=None): sfeeds_ids)) response = render_to_response('feedjack/%s/post_list.html' % \ - (site.template), ctx) + (site.template), ctx, context_instance=RequestContext(request)) # per host caching, in case the cache middleware is enabled patch_vary_headers(response, ['Host']) diff --git a/src/calibre/www/planet/README.rst b/src/calibre/www/planet/README.rst index 2ced5b6c76..8f40603284 100644 --- a/src/calibre/www/planet/README.rst +++ b/src/calibre/www/planet/README.rst @@ -1,29 +1,12 @@ Test ===== +Calibre planet can be run either in development mode or deployment mode. For testing, +it should be run in development mode as follows: + * Install django - * Run ``python manage.py syncdb`` to create database in /tmp/planet.db - * Run ``python manage.py runserver`` - * Goto `http://localhost:8000/admin` and create Feeds, Sites and Subscribers + * ``cd test && ./test`` * Planet is at `http://localhost:8000` -Update feeds by running:: - - DJANGO_SETTINGS_MODULE=calibre.www.planet.settings feedjack_update.py - -Deploy -======= - - * Add settings for deployment environment to settings.py - * In particular setup caching - - * Run python manage.py syncdb - * Add super user when asked - - * Setup Apache - - * Goto /admin and add feeds - - diff --git a/src/calibre/www/planet/settings.py b/src/calibre/www/planet/settings.py index 5c3a80b568..cd2f56ceb1 100644 --- a/src/calibre/www/planet/settings.py +++ b/src/calibre/www/planet/settings.py @@ -2,7 +2,7 @@ from calibre.www.settings import DEBUG, TEMPLATE_DEBUG, ADMINS, MANAGERS, \ TEMPLATE_LOADERS, TEMPLATE_DIRS, MIDDLEWARE_CLASSES, MEDIA_ROOT, \ - MEDIA_URL, ADMIN_MEDIA_PREFIX + MEDIA_URL, ADMIN_MEDIA_PREFIX, TEMPLATE_CONTEXT_PROCESSORS if not DEBUG: MEDIA_URL = 'http://planet.calibre-ebook.com/site_media/' diff --git a/src/calibre/www/planet/test/planet.db b/src/calibre/www/planet/test/planet.db new file mode 100644 index 0000000000..413abd4875 Binary files /dev/null and b/src/calibre/www/planet/test/planet.db differ diff --git a/src/calibre/www/planet/test/test.sh b/src/calibre/www/planet/test/test.sh new file mode 100755 index 0000000000..64a0976462 --- /dev/null +++ b/src/calibre/www/planet/test/test.sh @@ -0,0 +1,4 @@ +#!/bin/sh +cp planet.db /tmp +cd .. +python manage.py runserver diff --git a/src/calibre/www/publish.sh b/src/calibre/www/publish.sh new file mode 100755 index 0000000000..7a653f06f2 --- /dev/null +++ b/src/calibre/www/publish.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +ssh divok bzr up /usr/local/calibre +ssh divok /etc/init.d/apache2 graceful diff --git a/src/calibre/www/settings.py b/src/calibre/www/settings.py index 546ea9b0ab..d20185c943 100644 --- a/src/calibre/www/settings.py +++ b/src/calibre/www/settings.py @@ -75,6 +75,12 @@ else: '/usr/local/calibre/src/calibre/www/templates', ) +TEMPLATE_CONTEXT_PROCESSORS = ( + "django.core.context_processors.auth", + "django.core.context_processors.debug", + "django.core.context_processors.i18n", + "django.core.context_processors.media" + ) diff --git a/src/calibre/www/static/styles/base.css b/src/calibre/www/static/styles/base.css index d1b19ed5d0..c744301796 100644 --- a/src/calibre/www/static/styles/base.css +++ b/src/calibre/www/static/styles/base.css @@ -1,6 +1,6 @@ body { font-family: sansserif; - background-color: #eeeeee; + background-color: #f6f6f6; } img { @@ -12,6 +12,7 @@ img { border-bottom: 1px solid black; margin-bottom: 20px; height: 100px; + background-color: #d6d6d6; overflow: hidden; } diff --git a/src/calibre/www/static/styles/planet.css b/src/calibre/www/static/styles/planet.css index 084576bf5f..8cbca4a359 100644 --- a/src/calibre/www/static/styles/planet.css +++ b/src/calibre/www/static/styles/planet.css @@ -117,9 +117,8 @@ div.post-content { border-right: 1px dotted #ccc; } div.post-content li { - margin: 0; - padding: 0; line-height: 130%; + margin-bottom: 0.6em; } div.post-content table{ border: 0; diff --git a/src/calibre/www/templates/base.html b/src/calibre/www/templates/base.html index 245d7edc9b..1453d4ab73 100644 --- a/src/calibre/www/templates/base.html +++ b/src/calibre/www/templates/base.html @@ -7,14 +7,15 @@ --> {% block title %}calibre - E-book management{% endblock %} - + + {% block extra_header %} {% endblock %}

- + {% block header_text %}e-book management{% endblock %}

@@ -26,7 +27,7 @@ {% block footer_text %} Created by Kovid Goyal. Powered by - Django + Django    {% endblock %} diff --git a/src/calibre/www/templates/feedjack/default/post_list.html b/src/calibre/www/templates/feedjack/default/post_list.html index 94a8e0ee69..67b81a773e 100644 --- a/src/calibre/www/templates/feedjack/default/post_list.html +++ b/src/calibre/www/templates/feedjack/default/post_list.html @@ -4,8 +4,8 @@ {% block header_text %}Planet{% endblock %} {% block extra_header %} - - + + {% endblock %} {% block content %} @@ -31,10 +31,10 @@
- • - • - • - + • + • + • +
@@ -50,7 +50,7 @@
+ src="{{ MEDIA_URL }}/img/faces/{{ item.subscriber.shortname}}.png" alt="" />
{{ item.feed.title }}
@@ -90,7 +90,7 @@ Planet Calibre is a window into the world, work and lives of Calibre developers and contributors.

-If you have a question or would like your blog added to the feed. Please email +If you have a question or would like your blog added to the planet, please email Kovid Goyal.

@@ -151,7 +151,7 @@ title="feed (last modified: {{ feed.feed.last_modified }})" title="feed" {% endif %} > -feed +feed {{ feed.name }} {% endfor %}