基于Dragonboard 410c服务器系列之三搭建你的个人博客系统

处理器/DSP

876人已加入

描述

一、前言

相信经常逛各种各样博客的大家都或多或少都会吐槽博客系统一些生硬的设置,尤其是还有自己亲身撰写博客的创客大牛们,对博客后台文章的编辑系统更是又爱又恨~!博主对此感同身受,同时又突发奇想,为什么不构建自己的博客系统呢?于是,本篇文章应运而生!(基础的环境搭建大家可以参考博主《Dragonboard410c服务器系列》的文章)

二、主代码分析

1.代码框架

DragonBoard 410c

图1 代码框架

2.代码分享

2.1.myapp/views.py

#coding=utf-8
from django.shortcuts import render
from blog.models import BlogsPost
from django.shortcuts import render_to_response
 
# Create your views here.
def index(request):
blog_list = BlogsPost.objects.all()
return render_to_response('index.html',{'blog_list':blog_list})

2.2.myapp/models.py

from django.db import models
from django.contrib import admin
 
# Create your models here.
class BlogsPost(models.Model):
title = models.CharField(max_length = 150)
body = models.TextField()
timestamp = models.DateTimeField()
 
class BlogPostAdmin(admin.ModelAdmin):
list_display = ('title','timestamp')
 
admin.site.register(BlogsPost,BlogPostAdmin)

三、效果实测

DragonBoard 410c

图2 博客登录页面

DragonBoard 410c

图3 博客后台系统

DragonBoard 410c

图4 博客撰写后台

四、例程分享:

http://pan.baidu.com/s/1eRCqG5k

打开APP阅读更多精彩内容
声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉

全部0条评论

快来发表一下你的评论吧 !

×
20
完善资料,
赚取积分