def render(self, context): from settings import MEDIA_URL try: prefix = MEDIA_URL.rstrip("/") except: prefix = "" return "%s%s" % (prefix, self.file_path)
from django.conf.urls.defaults import * from django.conf import settings from django.views.generic.simple import direct_to_template from settings import MEDIA_URL, THEME_MEDIA_URL, MEDIA_ROOT, THEME_ROOT, THEME_MEDIA_URL #from blog.views import CheckCode #from utils import zipserve from django.contrib.auth.views import login, logout urlpatterns = patterns('', (r'^$', include('home.urls')), # [[ZY (r'^%s/(?P<path>.*)$' % MEDIA_URL.strip('/\\'), 'django.views.static.serve', {'document_root': MEDIA_ROOT}), (r'^%s/(?P<path>.*)$' % THEME_MEDIA_URL.strip('/\\'), 'theme_files.serve', {'document_root': THEME_ROOT}), (r'^about$', direct_to_template, { 'template': 'about.html', # TODO: About page show error style. }), (r'^weibo', include('sinaweibo.urls')), (r'^blog', include('blog.urls')), (r'^admin', include('admin.urls')), (r'^tests', include('tests.urls')), #(r'^checkcode/', CheckCode), #(r'^tinymce/(.*)', zipserve.make_zip_handler('tinymce.zip') ), #(r'^i18n/', include('django.conf.urls.i18n')) (r'^accounts/login/$', login), (r'^accounts/logout/$', logout), # ZY]]