This commit is contained in:
Kovid Goyal 2009-03-27 22:45:59 -07:00
parent b094f3bbb9
commit 2b935b720b
12 changed files with 38 additions and 42 deletions

View File

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

View File

@ -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'])

View File

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

View File

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

Binary file not shown.

View File

@ -0,0 +1,4 @@
#!/bin/sh
cp planet.db /tmp
cd ..
python manage.py runserver

4
src/calibre/www/publish.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
ssh divok bzr up /usr/local/calibre
ssh divok /etc/init.d/apache2 graceful

View File

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

View File

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

View File

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

View File

@ -7,14 +7,15 @@
-->
<head>
<title>{% block title %}calibre - E-book management{% endblock %}</title>
<link rel="stylesheet" type="text/css" href="{{ media_url }}/styles/base.css" />
<link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}/styles/base.css" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
{% block extra_header %} {% endblock %}
</head>
<body>
<div id="_header">
<h1>
<img id="_logo" alt="calibre" src="{{ media_url }}/img/logo.png" />
<img id="_logo" alt="calibre" src="{{ MEDIA_URL }}/img/logo.png" />
{% block header_text %}e-book management{% endblock %}
</h1>
</div>
@ -26,7 +27,7 @@
{% block footer_text %}
Created by Kovid Goyal.
Powered by <a href="http://www.djangoproject.com">
<img alt="Django" src="{{ media_url }}/img/button-django.png"/>
<img alt="Django" src="{{ MEDIA_URL }}/img/button-django.png"/>
</a>&nbsp;&nbsp;
{% endblock %}
</div>

View File

@ -4,8 +4,8 @@
{% block header_text %}Planet{% endblock %}
{% block extra_header %}
<link rel="stylesheet" type="text/css" href="{{ media_url }}/styles/planet.css" />
<link rel="stylesheet" type="text/css" href="{{ media_url }}/styles/codebox.css" />
<link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}/styles/planet.css" />
<link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}/styles/codebox.css" />
{% endblock %}
{% block content %}
@ -31,10 +31,10 @@
</div> <!-- end paginate -->
<div id="buttons">
<a href="{{ site.url }}/feed/rss/" title="RSS 2.0 feed"><img src="{{ media_url }}/img/button-rss.png"/></a> &bull;
<a href="{{ site.url }}/feed/atom/" title="Atom 1.0 feed"><img src="{{ media_url }}/img/button-atom.png"/></a> &bull;
<a href="{{ site.url }}/opml/" title="OPML"><img src="{{ media_url }}/img/button-opml.png"/></a> &bull;
<a href="{{ site.url }}/foaf/" title="FOAF"><img src="{{ media_url }}/img/button-foaf.png"/></a>
<a href="{{ site.url }}/feed/rss/" title="RSS 2.0 feed"><img src="{{ MEDIA_URL }}/img/button-rss.png"/></a> &bull;
<a href="{{ site.url }}/feed/atom/" title="Atom 1.0 feed"><img src="{{ MEDIA_URL }}/img/button-atom.png"/></a> &bull;
<a href="{{ site.url }}/opml/" title="OPML"><img src="{{ MEDIA_URL }}/img/button-opml.png"/></a> &bull;
<a href="{{ site.url }}/foaf/" title="FOAF"><img src="{{ MEDIA_URL }}/img/button-foaf.png"/></a>
</div> <!-- end buttons -->
<div id="post_list">
@ -50,7 +50,7 @@
<div class="avatar">
<a href="{{ item.feed.link }}">
<img
src="{{ media_url }}/img/faces/{{ item.subscriber.shortname}}.png" alt="" />
src="{{ MEDIA_URL }}/img/faces/{{ item.subscriber.shortname}}.png" alt="" />
<br/>
<span class="url">{{ item.feed.title }}</span>
</a>
@ -90,7 +90,7 @@
Planet Calibre is a window into the world, work and lives of Calibre developers and contributors.
</p>
<p style="text-align:left">
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
<a href="mailto:kovid@kovidgoyal.net">Kovid Goyal</a>.
</p>
@ -151,7 +151,7 @@ title="feed (last modified: {{ feed.feed.last_modified }})"
title="feed"
{% endif %}
>
<img src="{{ media_url }}/img/feed.png" alt="feed"></a>
<img src="{{ MEDIA_URL }}/img/feed.png" alt="feed"></a>
<a class="nombre" href="{{ site.url }}/user/{{ feed.feed.id }}"
title="{{ feed.feed.title }}">{{ feed.name }}</a></li>
{% endfor %}