{{post.post_content|markdown:"codehilite,nl2br"}}
27 | {%else%} 28 |{{post.post_content|autop:'true'}}
29 | {%endif%} 30 |\\\\w+)\\\\]$","U"),i=1,p=0;p{% trans 'Page not found' %} 9 | 10 | {% trans "We're sorry, but the requested page could not be found." %}
11 | 12 | {% endblock %} 13 | -------------------------------------------------------------------------------- /blog/templates/admin/500.html: -------------------------------------------------------------------------------- 1 | {% extends "admin/base_site.html" %} 2 | {% load i18n %} 3 | 4 | {% block breadcrumbs %} 5 | 9 | {% endblock %} 10 | 11 | {% block title %}{% trans 'Server error (500)' %}{% endblock %} 12 | 13 | {% block content %} 14 |{% trans 'Server Error (500)' %}
15 |{% trans "There's been an error. It's been reported to the site administrators via email and should be fixed shortly. Thanks for your patience." %}
16 | 17 | {% endblock %} 18 | -------------------------------------------------------------------------------- /blog/templates/admin/actions.html: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 |3 | {% for field in action_form %}{% if field.label %}{% endif %}{% endfor %} 4 | 5 | {% if actions_selection_counter %} 6 | 7 | {{ selection_note }} 8 | {% if cl.result_count != cl.result_list|length %} 9 | {{ selection_note_all }} 10 | 11 | {% blocktrans with cl.result_count as total_count %}Select all {{ total_count }} {{ module_name }}{% endblocktrans %} 12 | 13 | {% trans "Clear selection" %} 14 | {% endif %} 15 | {% endif %} 16 |17 | -------------------------------------------------------------------------------- /blog/templates/admin/app_index.html: -------------------------------------------------------------------------------- 1 | {% extends "admin/index.html" %} 2 | {% load i18n %} 3 | 4 | {% block bodyclass %}{{ block.super }} app-{{ app_label }}{% endblock %} 5 | 6 | {% if not is_popup %} 7 | {% block breadcrumbs %} 8 | 15 | {% endblock %} 16 | {% endif %} 17 | 18 | {% block sidebar %}{% endblock %} 19 | -------------------------------------------------------------------------------- /blog/templates/admin/auth/user/add_form.html: -------------------------------------------------------------------------------- 1 | {% extends "admin/change_form.html" %} 2 | {% load i18n %} 3 | 4 | {% block form_top %} 5 | {% if not is_popup %} 6 |{% trans "First, enter a username and password. Then, you'll be able to edit more user options." %}
7 | {% else %} 8 |{% trans "Enter a username and password." %}
9 | {% endif %} 10 | {% endblock %} 11 | 12 | {% block after_field_sets %} 13 | 14 | {% endblock %} 15 | -------------------------------------------------------------------------------- /blog/templates/admin/base_site.html: -------------------------------------------------------------------------------- 1 | {% extends "admin/base.html" %} 2 | 3 | {% block title %}{{ title }} | {{ site_title|default:_('evilbinary site admin') }}{% endblock %} 4 | 5 | {% block branding %} 6 |{{ site_header|default:_('evilbinary administration') }}
7 | {% endblock %} 8 | 9 | {% block nav-global %}{% endblock %} 10 | -------------------------------------------------------------------------------- /blog/templates/admin/change_list_results.html: -------------------------------------------------------------------------------- 1 | {% load i18n admin_static %}{% load cycle from future %} 2 | {% if result_hidden_fields %} 3 |{# DIV for HTML validation #} 4 | {% for item in result_hidden_fields %}{{ item }}{% endfor %} 5 |6 | {% endif %} 7 | {% if results %} 8 |9 |38 | {% endif %} 39 | -------------------------------------------------------------------------------- /blog/templates/admin/date_hierarchy.html: -------------------------------------------------------------------------------- 1 | {% if show %} 2 |10 | 11 |
37 |12 | {% for header in result_headers %} 13 | 27 | 28 | 29 | {% for result in results %} 30 | {% if result.form.non_field_errors %} 31 |14 | {% if header.sortable %} 15 | {% if header.sort_priority > 0 %} 16 | {% endfor %} 26 | 21 | {% endif %} 22 | {% endif %} 23 |{% if header.sortable %}{{ header.text|capfirst }}{% else %}{{ header.text|capfirst }}{% endif %}24 | 25 |32 | {% endif %} 33 | {{ result.form.non_field_errors }} {% for item in result %}{{ item }}{% endfor %} 34 | {% endfor %} 35 | 36 |3 |10 | {% endif %} 11 | -------------------------------------------------------------------------------- /blog/templates/admin/delete_confirmation.html: -------------------------------------------------------------------------------- 1 | {% extends "admin/base_site.html" %} 2 | {% load i18n admin_urls %} 3 | 4 | {% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} delete-confirmation{% endblock %} 5 | 6 | {% block breadcrumbs %} 7 | 14 | {% endblock %} 15 | 16 | {% block content %} 17 | {% if perms_lacking or protected %} 18 | {% if perms_lacking %} 19 |4 | {% if back %}
- ‹ {{ back.title }}
{% endif %} 5 | {% for choice in choices %} 6 |- {% if choice.link %}{% endif %}{{ choice.title }}{% if choice.link %}{% endif %}
7 | {% endfor %} 8 |
9 |{% blocktrans with escaped_object=object %}Deleting the {{ object_name }} '{{ escaped_object }}' would result in deleting related objects, but your account doesn't have permission to delete the following types of objects:{% endblocktrans %}
20 |21 | {% for obj in perms_lacking %} 22 |
25 | {% endif %} 26 | {% if protected %} 27 |- {{ obj }}
23 | {% endfor %} 24 |{% blocktrans with escaped_object=object %}Deleting the {{ object_name }} '{{ escaped_object }}' would require deleting the following protected related objects:{% endblocktrans %}
28 |29 | {% for obj in protected %} 30 |
33 | {% endif %} 34 | {% else %} 35 |- {{ obj }}
31 | {% endfor %} 32 |{% blocktrans with escaped_object=object %}Are you sure you want to delete the {{ object_name }} "{{ escaped_object }}"? All of the following related items will be deleted:{% endblocktrans %}
36 |{{ deleted_objects|unordered_list }}
37 | 43 | {% endif %} 44 | {% endblock %} 45 | -------------------------------------------------------------------------------- /blog/templates/admin/delete_selected_confirmation.html: -------------------------------------------------------------------------------- 1 | {% extends "admin/base_site.html" %} 2 | {% load i18n l10n admin_urls %} 3 | 4 | {% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} delete-confirmation delete-selected-confirmation{% endblock %} 5 | 6 | {% block breadcrumbs %} 7 | 13 | {% endblock %} 14 | 15 | {% block content %} 16 | {% if perms_lacking or protected %} 17 | {% if perms_lacking %} 18 |{% blocktrans %}Deleting the selected {{ objects_name }} would result in deleting related objects, but your account doesn't have permission to delete the following types of objects:{% endblocktrans %}
19 |20 | {% for obj in perms_lacking %} 21 |
24 | {% endif %} 25 | {% if protected %} 26 |- {{ obj }}
22 | {% endfor %} 23 |{% blocktrans %}Deleting the selected {{ objects_name }} would require deleting the following protected related objects:{% endblocktrans %}
27 |28 | {% for obj in protected %} 29 |
32 | {% endif %} 33 | {% else %} 34 |- {{ obj }}
30 | {% endfor %} 31 |{% blocktrans %}Are you sure you want to delete the selected {{ objects_name }}? All of the following objects and their related items will be deleted:{% endblocktrans %}
35 | {% for deletable_object in deletable_objects %} 36 |{{ deletable_object|unordered_list }}
37 | {% endfor %} 38 | 48 | {% endif %} 49 | {% endblock %} 50 | -------------------------------------------------------------------------------- /blog/templates/admin/edit_inline/stacked.html: -------------------------------------------------------------------------------- 1 | {% load i18n admin_static %} 2 |3 |20 | 21 | 31 | -------------------------------------------------------------------------------- /blog/templates/admin/filter.html: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 |{{ inline_admin_formset.opts.verbose_name_plural|capfirst }}
4 | {{ inline_admin_formset.formset.management_form }} 5 | {{ inline_admin_formset.formset.non_form_errors }} 6 | 7 | {% for inline_admin_form in inline_admin_formset %} {% endfor %} 19 |{% blocktrans with filter_title=title %} By {{ filter_title }} {% endblocktrans %}
3 |4 | {% for choice in choices %} 5 |
9 | -------------------------------------------------------------------------------- /blog/templates/admin/includes/fieldset.html: -------------------------------------------------------------------------------- 1 | {% load myfilter %} 2 | 32 | -------------------------------------------------------------------------------- /blog/templates/admin/invalid_setup.html: -------------------------------------------------------------------------------- 1 | {% extends "admin/base_site.html" %} 2 | {% load i18n %} 3 | 4 | {% block breadcrumbs %} 5 | 9 | {% endblock %} 10 | 11 | {% block content %} 12 |- 6 | {{ choice.display }}
7 | {% endfor %} 8 |{% trans "Something's wrong with your database installation. Make sure the appropriate database tables have been created, and make sure the database is readable by the appropriate user." %}
13 | {% endblock %} 14 | -------------------------------------------------------------------------------- /blog/templates/admin/login.html: -------------------------------------------------------------------------------- 1 | {% extends "admin/base_site.html" %} 2 | {% load i18n admin_static %} 3 | 4 | {% block extrastyle %}{{ block.super }}{% endblock %} 5 | 6 | {% block bodyclass %}{{ block.super }} login{% endblock %} 7 | 8 | {% block nav-global %}{% endblock %} 9 | 10 | {% block content_title %}{% endblock %} 11 | 12 | {% block breadcrumbs %}{% endblock %} 13 | 14 | {% block content %} 15 | {% if form.errors and not form.non_field_errors %} 16 |17 | {% if form.errors.items|length == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %} 18 |
19 | {% endif %} 20 | 21 | {% if form.non_field_errors %} 22 | {% for error in form.non_field_errors %} 23 |24 | {{ error }} 25 |
26 | {% endfor %} 27 | {% endif %} 28 | 29 |30 | 50 | 51 | 54 |55 | {% endblock %} 56 | -------------------------------------------------------------------------------- /blog/templates/admin/object_history.html: -------------------------------------------------------------------------------- 1 | {% extends "admin/base_site.html" %} 2 | {% load i18n admin_urls %} 3 | 4 | {% block breadcrumbs %} 5 | 12 | {% endblock %} 13 | 14 | {% block content %} 15 |16 |42 | {% endblock %} 43 | -------------------------------------------------------------------------------- /blog/templates/admin/pagination.html: -------------------------------------------------------------------------------- 1 | {% load admin_list %} 2 | {% load i18n %} 3 |17 | 18 | {% if action_list %} 19 |41 |20 | 21 |
37 | {% else %} 38 |22 | 26 | 27 | 28 | {% for action in action_list %} 29 |{% trans 'Date/time' %} 23 |{% trans 'User' %} 24 |{% trans 'Action' %} 25 |30 | 34 | {% endfor %} 35 | 36 |{{ action.action_time|date:"DATETIME_FORMAT" }} 31 |{{ action.user.get_username }}{% if action.user.get_full_name %} ({{ action.user.get_full_name }}){% endif %} 32 |{{ action.change_message }} 33 |{% trans "This object doesn't have a change history. It probably wasn't added via this admin site." %}
39 | {% endif %} 40 |4 | {% if pagination_required %} 5 | {% for i in page_range %} 6 | {% paginator_number cl i %} 7 | {% endfor %} 8 | {% endif %} 9 | {{ cl.result_count }} {% ifequal cl.result_count 1 %}{{ cl.opts.verbose_name }}{% else %}{{ cl.opts.verbose_name_plural }}{% endifequal %} 10 | {% if show_all_url %} {% trans 'Show all' %}{% endif %} 11 | {% if cl.formset and cl.result_count %}{% endif %} 12 |
13 | -------------------------------------------------------------------------------- /blog/templates/admin/popup_response.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |4 | 5 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /blog/templates/admin/prepopulated_fields_js.html: -------------------------------------------------------------------------------- 1 | {% load l10n %} 2 | 28 | -------------------------------------------------------------------------------- /blog/templates/admin/search_form.html: -------------------------------------------------------------------------------- 1 | {% load i18n admin_static %} 2 | {% if cl.search_fields %} 3 | 16 | 17 | {% endif %} 18 | -------------------------------------------------------------------------------- /blog/templates/admin/submit_line.html: -------------------------------------------------------------------------------- 1 | {% load i18n admin_urls %} 2 | 3 | {% if show_save %}{% endif %} 4 | {% if show_delete_link %} 5 | {% url opts|admin_urlname:'delete' original.pk|admin_urlquote as delete_url %} 6 | 7 | {% endif %} 8 | {% if show_save_as_new %}{%endif%} 9 | {% if show_save_and_add_another %}{% endif %} 10 | {% if show_save_and_continue %}{% endif %} 11 |12 | -------------------------------------------------------------------------------- /blog/templates/archive.html: -------------------------------------------------------------------------------- 1 | {% for post in posts %} 2 |{{post.post_titile}}
3 |{{post.post_date}}
4 |{{post.post_title}}
5 |{{post.post_content}}
6 | {% endfor%} 7 | -------------------------------------------------------------------------------- /blog/templates/base.html: -------------------------------------------------------------------------------- 1 | {%block header%} 2 | {%endblock%} 3 | {%block middle%} 4 | {%endblock%} 5 | {%block test%} 6 | {%endblock%} 7 | {%block footer%} 8 | {%endblock%} -------------------------------------------------------------------------------- /blog/templates/comment_block copy.html: -------------------------------------------------------------------------------- 1 | {% load gravatar %} 2 | 3 |4 | -------------------------------------------------------------------------------- /blog/templates/comment_block.html: -------------------------------------------------------------------------------- 1 | {% load gravatar %} 2 | 3 |5 | 43 |6 | {%if not comment.comment_author_email %} 7 | 33 | 34 |8 | {%else%} 9 | {%if level < 1 %} 10 |
11 | {%else%} 12 |
13 | {%endif%} 14 | {%endif%} 15 | 16 | 17 | {%if comment.comment_author_url != ''%} 18 | {{comment.comment_author}} 19 | {%else%} 20 | {{comment.comment_author}} 21 | {%endif%} 22 | 23 | {%if comment.user_id != 0%} 24 | Post author 25 | {%else%} 26 | 27 | {%endif%} 28 | 29 | 30 | 31 | 32 |
40 | ↓ 41 |42 |4 | 51 | 52 | -------------------------------------------------------------------------------- /blog/templates/header.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |5 | {%if not comment.comment_author_email %} 6 |49 | 50 |7 | {%else%} 8 | {%if level < 1 %} 9 |
10 | {%else%} 11 |
12 | {%endif%} 13 | {%endif%} 14 |
15 |48 |16 | {%if comment.comment_author_url != ''%} 17 | {{comment.comment_author}} 18 | {%else%} 19 |36 |{{comment.comment_author}}20 | {%endif%} 21 | {%if comment.user_id != 0%} 22 | Post author 23 | {%else%} 24 | 25 | {%endif%} 26 | 27 | 32 | 33 | 35 | 34 |37 | 38 | {{comment.comment_content}} 39 | {%if comment.comment_approved = '0' %} 40 | 您的评论已经提交等待博主审核! 41 | {%endif%} 42 | 43 | 44 |45 | 46 | 47 |{{headeinfo.title}} 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |15 | 23 |16 | evilbinary 17 | 21 |22 |24 |9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 58 | 59 | 60 |25 | 26 | 49 | 50 |{{headeinfo.blogname}}
27 |{{headeinfo.blogdescription}}
28 | 29 | 30 | 47 | 48 |-------------------------------------------------------------------------------- /blog/templates/index.html: -------------------------------------------------------------------------------- 1 | {%extends "base.html"%} 2 | {%block header%} 3 | {{header}} 4 | {%endblock%} 5 | {%block middle%} 6 |3 | 8 |7 |11 | {{sidebar}} 12 | {%endblock%} 13 | {%block footer%} 14 | {{footer}} 15 | {%endblock%} 16 | 17 | -------------------------------------------------------------------------------- /blog/templates/page.html: -------------------------------------------------------------------------------- 1 | {{page_contents}} 2 | {{page_nator}} 3 | {{page_comment}} 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /blog/templates/page_nator.html: -------------------------------------------------------------------------------- 1 |8 | {{contents}} 9 |10 |2 | 3 | 4 | 5 | {% if page.has_previous %} 6 | 首页 7 | 上一页 8 | {%else%} 9 | 首页 10 | 上一页 11 | 12 | {% endif %} 13 | 14 | {% for i in page.paginator.page_range_ext %} 15 | {%if i = page.number %} 16 | 17 | {{i}} 18 | {%else%} 19 | {{i}} 20 | {%endif%} 21 | {% endfor%} 22 | {% if page.has_next %} 23 | 下一页 24 | 尾页 25 | {%else%} 26 | 下一页 27 | 尾页 28 | 29 | {% endif %} 30 | 共{{ page.paginator.num_pages }}页. 31 | 32 | 33 |-------------------------------------------------------------------------------- /blog/templates/page_nav.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /blog/templates/test.html: -------------------------------------------------------------------------------- 1 | 2 | {{test}} 3 | cats================= 4 | {{cats}} 5 |
6 | links================ 7 | {{links}} 8 |
9 | ------------------------- 10 |
11 | {%for x,y in links.items%} 12 | {{x}}
13 | {%for l in y%} 14 | {{l}}
15 | {%endfor%} 16 |
17 | 18 | {%endfor%} 19 | comment_content:{{form.content.errors}} 20 | comment_author:{{form.author.errors}} 21 | comment_author_email:{{form.email.errors}} 22 | 23 | -------------------------------------------------------------------------------- /blog/templatetags/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evilbinary/myblog/4584758b4cbc285b482ae9a5401ff98482afe7ef/blog/templatetags/__init__.py -------------------------------------------------------------------------------- /blog/templatetags/gravatar.py: -------------------------------------------------------------------------------- 1 | #coding=utf-8 2 | #!/usr/bin/env python 3 | # -*- coding:utf-8 -*- 4 | # Author : evilbinary.org 5 | # E-mail : rootntsd@gmail.com 6 | # Date : 14/10/1 12:21:19 7 | # Desc : 8 | 9 | from django import template 10 | import urllib 11 | import hashlib 12 | from django.conf import settings 13 | 14 | register = template.Library() 15 | 16 | GRAVATAR_URL_PREFIX = getattr(settings, "GRAVATAR_URL_PREFIX", "http://www.gravatar.com/avatar/") 17 | GRAVATAR_DEFAULT_IMAGE = getattr(settings, "GRAVATAR_DEFAULT_IMAGE", "/static/img/avatar.jpg") 18 | 19 | class GravatarUrlNode(template.Node): 20 | def __init__(self, email): 21 | self.email = template.Variable(email) 22 | 23 | def render(self, context): 24 | try: 25 | email = self.email.resolve(context) 26 | except template.VariableDoesNotExist: 27 | return '' 28 | 29 | default = GRAVATAR_DEFAULT_IMAGE 30 | size = 40 31 | 32 | gravatar_url = GRAVATAR_URL_PREFIX + hashlib.md5(email.lower()).hexdigest() + "?" 33 | gravatar_url += urllib.urlencode({'d':default, 's':str(size)}) 34 | return gravatar_url 35 | 36 | @register.tag 37 | def gravatar_url(parser, token): 38 | try: 39 | tag_name, email = token.split_contents() 40 | except ValueError: 41 | raise template.TemplateSyntaxError, "%r tag requires a single argument" % token.contents.split()[0] 42 | 43 | return GravatarUrlNode(email) 44 | 45 | @register.filter 46 | def get_gravatar(email,size=44,verify_default=False): 47 | try: 48 | gravatar_url=GRAVATAR_URL_PREFIX + hashlib.md5(email.lower()).hexdigest()+'?s=%d' %size 49 | if (verify_default): 50 | gravatar_url += '&d=404' 51 | try: 52 | urllib2.urlopen(gravatar_url) 53 | except urllib2.URLError, e: 54 | return None 55 | return gravatar_url 56 | except Exception,e: 57 | return '' 58 | -------------------------------------------------------------------------------- /blog/templatetags/md2.py: -------------------------------------------------------------------------------- 1 | """ 2 | Markdown2 filter, requires the python-markdown2 library from 3 | http://code.google.com/p/python-markdown2 4 | 5 | This code is based on django's markup contrib. 6 | """ 7 | 8 | from django import template 9 | from django.conf import settings 10 | from django.utils.encoding import force_unicode 11 | from django.utils.safestring import mark_safe 12 | 13 | register = template.Library() 14 | 15 | 16 | @register.filter(name='markdown2') 17 | def markdown(value, arg=''): 18 | """ 19 | Runs Markdown over a given value, optionally using various 20 | extensions python-markdown supports. 21 | 22 | Syntax:: 23 | 24 | {{ value|markdown2:"extension1_name,extension2_name..." }} 25 | 26 | To enable safe mode, which strips raw HTML and only returns HTML 27 | generated by actual Markdown syntax, pass "safe" as the first 28 | extension in the list. 29 | 30 | If the version of Markdown in use does not support extensions, 31 | they will be silently ignored. 32 | 33 | """ 34 | try: 35 | import markdown2 36 | except ImportError: 37 | if settings.DEBUG: 38 | raise template.TemplateSyntaxError, "Error in {% markdown %} filter: The python-markdown2 library isn't installed." 39 | return force_unicode(value) 40 | else: 41 | def parse_extra(extra): 42 | if ':' not in extra: 43 | return (extra, {}) 44 | name, values = extra.split(':', 1) 45 | values = dict((str(val.strip()), True) for val in values.split('|')) 46 | return (name.strip(), values) 47 | 48 | extras = (e.strip() for e in arg.split(',')) 49 | extras = dict(parse_extra(e) for e in extras if e) 50 | 51 | if 'safe' in extras: 52 | del extras['safe'] 53 | safe_mode = True 54 | else: 55 | safe_mode = False 56 | 57 | return mark_safe(markdown2.markdown(force_unicode(value), extras=extras, safe_mode=safe_mode)) 58 | markdown.is_safe = True 59 | -------------------------------------------------------------------------------- /blog/templatetags/my_filter.py: -------------------------------------------------------------------------------- 1 | from django import template 2 | from django.utils.html import conditional_escape 3 | from django.utils.safestring import mark_safe 4 | 5 | 6 | register=template.Library() 7 | 8 | 9 | @register.filter(name='autop') 10 | def autop_filter(value,autoescape=None): 11 | values=value.split('\n\r') 12 | ret='' 13 | esc=None 14 | if autoescape==None: 15 | esc = conditional_escape 16 | else: 17 | esc = lambda x: x 18 | pass 19 | for v in values: 20 | if v=='\r': 21 | ret=esc(ret)+'
' 22 | else: 23 | ret=ret+''+esc(v).replace('\r','
' 24 | ret=mark_safe(ret) 25 | return ret 26 | 27 | -------------------------------------------------------------------------------- /blog/tests.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding:utf-8 -*- 3 | # Author : evilbinary.org 4 | # E-mail : rootntsd@gmail.com 5 | # Date : 14/10/1 12:21:19 6 | # Desc : 测试 7 | 8 | 9 | from django.test import TestCase 10 | 11 | # Create your tests here. 12 | -------------------------------------------------------------------------------- /blog/urls.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding:utf-8 -*- 3 | # Author : evilbinary.org 4 | # E-mail : rootntsd@gmail.com 5 | # Date : 14/10/1 11:21:19 6 | # Desc : url定义 7 | 8 | from django.conf.urls import * 9 | from blog import views 10 | from django.conf import settings 11 | from blog.views import * 12 | from django.contrib import admin 13 | from feeds import ArticlesFeed,CommentsFeed 14 | 15 | urlpatterns= patterns('blog.views', 16 | url(r'^$','index'), 17 | url(r'^blog/','index'), 18 | url(r'^archive/(\d{4})/(\d{1,2})/$','archive'), 19 | url(r'^article/(\d+)/$', 'article'), 20 | url(r'^articles/(\d{4})/$', 'year_archive'), 21 | url(r'^articles/(\d{4})/(\d{2})/$','month_archive'), 22 | url(r'^articles/(\d{4})/(\d{2})/(\d+)/$', 'article_detail'), 23 | url(r'^pages(?P
')+'\d+)/$', 'pages'), 24 | url(r'^pages/$', 'pages'), 25 | url(r'^pages/(?P \d+)/$', 'pages'), 26 | url(r'^page/(?P \d+)$', 'page'), 27 | # url(r'^test(?P \d+)/$', 'page'), 28 | url(r'^comment','comment'), 29 | url(r'^search/$','search'), 30 | url(r'^cat/(?P \d+)$','cat'), 31 | url(r'^archives/(?P \d+)/$','archives'), 32 | url(r'^archives$','archives'), 33 | url(r'^feeds/rss2$',ArticlesFeed()), 34 | url(r'^feeds/comments-rss2$',CommentsFeed()), 35 | url(r'^feeds/(?P \S+)$','feed'), 36 | url(r'^test$','test'), 37 | url(r'^page_expir$','page_expir'), 38 | 39 | ) 40 | -------------------------------------------------------------------------------- /data/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evilbinary/myblog/4584758b4cbc285b482ae9a5401ff98482afe7ef/data/.gitkeep -------------------------------------------------------------------------------- /data/s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evilbinary/myblog/4584758b4cbc285b482ae9a5401ff98482afe7ef/data/s.png -------------------------------------------------------------------------------- /data/screen-shot1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evilbinary/myblog/4584758b4cbc285b482ae9a5401ff98482afe7ef/data/screen-shot1.png -------------------------------------------------------------------------------- /data/screen-shot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evilbinary/myblog/4584758b4cbc285b482ae9a5401ff98482afe7ef/data/screen-shot2.png -------------------------------------------------------------------------------- /libs/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evilbinary/myblog/4584758b4cbc285b482ae9a5401ff98482afe7ef/libs/.gitkeep -------------------------------------------------------------------------------- /manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding:utf-8 -*- 3 | # Author : cold 4 | # E-mail : rootntsd@gmail.com 5 | # Date : 14/10/1 12:21:19 6 | # Desc : 7 | import os 8 | import sys 9 | 10 | if __name__ == "__main__": 11 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings") 12 | 13 | from django.core.management import execute_from_command_line 14 | 15 | execute_from_command_line(sys.argv) 16 | -------------------------------------------------------------------------------- /media/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evilbinary/myblog/4584758b4cbc285b482ae9a5401ff98482afe7ef/media/.DS_Store -------------------------------------------------------------------------------- /media/uploads/test.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evilbinary/myblog/4584758b4cbc285b482ae9a5401ff98482afe7ef/media/uploads/test.txt -------------------------------------------------------------------------------- /mysite/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding:utf-8 -*- 3 | # Author : cold 4 | # E-mail : rootntsd@gmail.com 5 | # Date : 14/10/1 12:21:19 6 | # Desc : -------------------------------------------------------------------------------- /mysite/urls.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding:utf-8 -*- 3 | # Author : cold 4 | # E-mail : rootntsd@gmail.com 5 | # Date : 14/10/1 12:21:19 6 | # Desc : 7 | from django.conf.urls import patterns, include, url 8 | from django.contrib import admin 9 | from django.conf.urls.static import static 10 | from django.conf import settings 11 | 12 | urlpatterns = patterns('', 13 | # Examples: 14 | # url(r'^$', 'mysite.views.home', name='home'), 15 | url(r'^$', include('blog.urls')), 16 | url(r'^blog/', include('blog.urls')), 17 | 18 | url(r'^admin/', include(admin.site.urls)), 19 | url(r'^ckeditor/', include('ckeditor_uploader.urls')), 20 | )+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) 21 | -------------------------------------------------------------------------------- /mysite/wsgi.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding:utf-8 -*- 3 | # Author : cold 4 | # E-mail : rootntsd@gmail.com 5 | # Date : 14/10/1 12:21:19 6 | # Desc : 7 | """ 8 | WSGI config for mysite project. 9 | 10 | It exposes the WSGI callable as a module-level variable named ``application``. 11 | 12 | For more information on this file, see 13 | https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/ 14 | """ 15 | 16 | import os 17 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings") 18 | 19 | from django.core.wsgi import get_wsgi_application 20 | application = get_wsgi_application() 21 | -------------------------------------------------------------------------------- /nginx-cfg/default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 8080; 3 | server_name 127.0.0.1 localhost .openshiftapps.com .evilbinary.org; 4 | charset UTF-8; 5 | #access_log /opt/app-root/project/access_log; 6 | #error_log /opt/app-root/project/error_log; 7 | 8 | location / { 9 | include uwsgi_params; 10 | uwsgi_pass 127.0.0.1:8000; 11 | uwsgi_read_timeout 10; 12 | } 13 | location ~ ^/(images|javascript|js|css|flash|media|static)/ { 14 | root /opt/app-root/src/; 15 | expires 130d; 16 | } 17 | root /opt/app-root/src; 18 | index index.html; 19 | } -------------------------------------------------------------------------------- /nginx-default-cfg/alias.conf: -------------------------------------------------------------------------------- 1 | location /aliased/ { 2 | alias /opt/app-root/src/; 3 | } -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | Django==1.7 2 | pysqlite 3 | pytz 4 | Markdown==2.5.1 5 | Pygments==1.6 6 | MySQL-python 7 | django-admin-bootstrapped==2.1.0 8 | beautifulsoup4==4.3.2 9 | Pillow==5.3.0 10 | django-ckeditor===5.0.3 11 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding:utf-8 -*- 3 | # Author : cold 4 | # E-mail : rootntsd@gmail.com 5 | # Date : 14/10/1 12:21:19 6 | # Desc : 7 | 8 | from setuptools import setup 9 | 10 | setup( 11 | name='Blog', 12 | version='1.1', 13 | description='evilbinary blog app', 14 | author='evilbinary', 15 | author_email='rootntsd@gmail.com', 16 | url='http://www.python.org/sigs/distutils-sig/', 17 | install_requires=['Django==1.7','pysqlite','pytz','Markdown>=2.5.1','Pygments>=1.6','MySQL-python','django-admin-bootstrapped==2.1.0','beautifulsoup4>=4.3.2','Pillow','django-ckeditor'], 18 | ) 19 | -------------------------------------------------------------------------------- /static/README: -------------------------------------------------------------------------------- 1 | Public, static content goes here. Users can create rewrite rules to link to 2 | content in the static dir. For example, django commonly uses /media/ 3 | directories for static content. For example in a .htaccess file in a 4 | wsgi/.htaccess location, developers could put: 5 | 6 | RewriteEngine On 7 | RewriteRule ^application/media/(.+)$ /static/media/$1 [L] 8 | 9 | Then copy the media/* content to yourapp/wsgi/static/media/ and it should 10 | just work. 11 | 12 | Note: The ^application/ part of the URI match is required. 13 | -------------------------------------------------------------------------------- /static/css/tst: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evilbinary/myblog/4584758b4cbc285b482ae9a5401ff98482afe7ef/static/css/tst -------------------------------------------------------------------------------- /static/img/tst: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evilbinary/myblog/4584758b4cbc285b482ae9a5401ff98482afe7ef/static/img/tst -------------------------------------------------------------------------------- /static/js/tst: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evilbinary/myblog/4584758b4cbc285b482ae9a5401ff98482afe7ef/static/js/tst -------------------------------------------------------------------------------- /templates/archive.html: -------------------------------------------------------------------------------- 1 | {% for post in posts %} 2 | {{post.post_titile}}
3 |{{post.post_date}}
4 |{{post.post_title}}
5 |{{post.post_content}}
6 | {% endfor%} 7 | -------------------------------------------------------------------------------- /templates/base.html: -------------------------------------------------------------------------------- 1 | {%block header%} 2 | {%endblock%} 3 | 4 | 5 | {%block middle%} 6 | 7 | {%endblock%} 8 | 9 | {%block test%} 10 | {%endblock%} 11 | 12 | {%block footer%} 13 | {%endblock%} 14 | 15 | 16 | -------------------------------------------------------------------------------- /templates/content.html: -------------------------------------------------------------------------------- 1 | {% load myfilter %} 2 | {% load md2 %} 3 | {%for post in posts%} 4 |5 | 56 | {%endfor%} 57 | 58 | {{info}} -------------------------------------------------------------------------------- /templates/footer.html: -------------------------------------------------------------------------------- 1 | 2 |6 | {%if post.post_type == 'post'%} 7 | 23 | 24 |{{post.post_title}}
8 | {%endif%} 9 |10 | {%if post.post_type == 'post'%} 11 | 12 | {%else%} 13 | 14 | {%endif%} 15 | {%if post.comment_count > 0%} 16 | {{post.comment_count}}条回复 17 | {%else%} 18 | 发表回复 19 | {%endif%} 20 | 21 |22 |25 | {% if post.post_mime_type == "markdown" %} 26 |31 | 32 | 54 | 55 |{{post.post_content|markdown:"codehilite,nl2br"}}
27 | {%else%} 28 |{{post.post_content|autop:'true'}}
29 | {%endif%} 30 |
{{comment.comment_content}}
36 | 37 |