一、简介

zinnia是免费的blog模块,自己可根据需要在之上修改,形成自己风格的博客。

二、zinnia安装

GitHub上的地址是https://github.com/Fantomas42/django-blog-zinnia

按照GitHub上的安装流程,即可正确安装,具体见https://github.com/Fantomas42/django-blog-zinnia/blob/develop/docs/getting-started/install.rst。

copy如下:

Installation

Dependencies

Make sure to install these packages prior to installation :

  • Python >= 2.7
  • Django >= 1.7,<1.9
  • Pillow >= 2.0.0
  • django-mptt >= 0.5.1
  • django-tagging >= 0.3.6
  • beautifulsoup4 >= 4.1.3
  • mots-vides >= 2015.2.6
  • django-contrib-comments >= 1.6

The packages below are optionnal but needed for run the full test suite or migrate the database.

  • pytz
  • pyparsing >= 2.0.1
  • django-xmlrpc >= 0.1.5

Note that all the needed dependencies will be resolved if you install Zinnia with :program:`pip` or :program:`easy_install`, excepting Django.

Getting the code

For the latest stable version of Zinnia use :program:`easy_install`:

$ easy_install django-blog-zinnia

or use :program:`pip`:

$ pip install django-blog-zinnia

You could also retrieve the last sources from https://github.com/Fantomas42/django-blog-zinnia. Clone the repository using :program:`git` and run the installation script:

$ git clone git://github.com/Fantomas42/django-blog-zinnia.git
$ cd django-blog-zinnia
$ python setup.py install

or more easily via :program:`pip`:

$ pip install -e git://github.com/Fantomas42/django-blog-zinnia.git#egg=django-blog-zinnia

Applications

Assuming that you have an already existing Django project, register :mod:`zinnia`, and these following applications in the :setting:`INSTALLED_APPS` section of your project's settings.

INSTALLED_APPS = ('django.contrib.auth','django.contrib.admin','django.contrib.sites','django.contrib.sessions','django.contrib.messages','django.contrib.staticfiles','django.contrib.contenttypes','django_comments','mptt','tagging','zinnia',
)

Template Context Processors

Add these following :setting:`template context processors<TEMPLATE_CONTEXT_PROCESSORS>` if not already present.

TEMPLATES = [{'BACKEND': 'django.template.backends.django.DjangoTemplates','APP_DIRS': True,'OPTIONS': {'context_processors': ['django.contrib.auth.context_processors.auth','django.template.context_processors.i18n','django.template.context_processors.request','django.contrib.messages.context_processors.messages','zinnia.context_processors.version',  # Optional]}}
]

URLs

Add at least these following lines to your project's urls.py in order to display the Weblog.

url(r'^weblog/', include('zinnia.urls', namespace='zinnia')),
url(r'^comments/', include('django_comments.urls')),

Remember to enable the :mod:`~django.contrib.admin` site in the urls.py of your project if you haven't done it yet for having the edition capabilities.

Note that the default Zinnia URLset :mod:`zinnia.urls` is calibrated for convenient usage, but you can customize your Weblog URLs as you want. Here's a custom implementation of the URLs provided by Zinnia:

blog_urls = [url(r'^', include('zinnia.urls.capabilities')),url(r'^search/', include('zinnia.urls.search')),url(r'^sitemap/', include('zinnia.urls.sitemap')),url(r'^trackback/', include('zinnia.urls.trackback')),url(r'^blog/tags/', include('zinnia.urls.tags')),url(r'^blog/feeds/', include('zinnia.urls.feeds')),url(r'^blog/random/', include('zinnia.urls.random')),url(r'^blog/authors/', include('zinnia.urls.authors')),url(r'^blog/categories/', include('zinnia.urls.categories')),url(r'^blog/comments/', include('zinnia.urls.comments')),url(r'^blog/', include('zinnia.urls.entries')),url(r'^blog/', include('zinnia.urls.archives')),url(r'^blog/', include('zinnia.urls.shortlink')),url(r'^blog/', include('zinnia.urls.quick_entry'))
]url(r'^', include(blog_urls, namespace='zinnia'))

Sites

Define the value of :setting:`SITE_ID` if not already done.

SITE_ID = 1

Emails

Be sure that the sending of emails is correctly configured, otherwise the moderation system will not work. Please refer to https://docs.djangoproject.com/en/dev/topics/email/ for more information about sending emails.

Static Files

Since the version 1.3 of Django, Zinnia uses the :mod:`~django.contrib.staticfiles` application to serve the static files needed. Please refer to https://docs.djangoproject.com/en/dev/howto/static-files/ for more information about serving static files.

Syncing the database

Now that you have everything set up, simply run the following in your project directory to sync the models with the database.

$ python manage.py migrate

安装完之后,整个zinnia安装在python的site-packages中。其中还有django-comments、mptt和tagging。

三、zinnia初次接触

1、可以将zinnia从site-packages移动到自己的工程目录中
如图:
我的django工程目录是mysite,zinnia放置到与django教程中polls工程同目录
2、需要修改settings.py,映射APP
INSTALLED_APPS = ('django.contrib.auth','django.contrib.admin','django.contrib.sites','django.contrib.sessions','django.contrib.messages','django.contrib.staticfiles','django.contrib.contenttypes','django_comments','mptt','tagging','zinnia.apps.ZinnaConfig',
)
3、重新python managy.py migrate生成models

这样就可以将site-package中的zinnia移动到自己的目录。同理,mptt,tagging,django_comments都可以这样移动,如果没有app.py就新建一个,并在其中编写AppConfig的继承类,如ZinniaConfig。

4、默认的zinnia是英文的,但是支持多语言,如下修改settings.py,最后一行去掉注释

Django-blog-zinnia初体验(一)相关推荐

  1. 两个ORM的pk初体验:Peewee VS SQLAlchemy

    之前从MySQL数据库捞数据都是使用的Peewee的ORM进行的获取,同时对于获取的结果,使用其强大的insert_many方法也能快速的导入大批量的数据. 现在实习的过程中,要上线一个服务,服务中要 ...

  2. 小程序 缩放_缩放流星应用程序的初体验

    小程序 缩放 by Elie Steinbock 埃莉·斯坦博克(Elie Steinbock) 缩放流星应用程序的初体验 (First Experiences Scaling a Meteor Ap ...

  3. 用鸿蒙跑了个 “hello world”!鸿蒙开发初体验

    点击上方蓝色"方志朋",选择"设为星标" 回复"666"获取独家整理的学习资料! 来源 | https://my.oschina.net/u ...

  4. 深度探索Hyperledger技术与应用之超级账本初体验(附部署代码)

    2019独角兽企业重金招聘Python工程师标准>>> 本章零基础地介绍了如何快速体验超级账本搭建的区块链网络,我们先绕过了比较复杂的初始化配置,用官方提供的fabric-sampl ...

  5. 来自新手Banana Pi香蕉派初体验

    2019独角兽企业重金招聘Python工程师标准>>> 一.前言 一段时间来对有强大的技术支持和完善的社区的Raspberry Pi很感兴趣,本想入一片学习学习,但转念一想Raspb ...

  6. ES6 Generator 初体验

    2019独角兽企业重金招聘Python工程师标准>>> ES6 Generator 初体验 听说 ES6 的 Generator 是一个很神奇的函数,所以去了解了一下. 因为它不同于 ...

  7. Windows Embedded CE 6.0开发初体验(二)CE开发环境 收藏

    上一篇<Windows Embedded CE 6.0开发初体验>之"嵌入式开发流程": http://blog.csdn.net/aawolf/archive/200 ...

  8. 树莓派2代B model 上手初体验,不用显示器,Python GPIO 点亮一颗LED

    开题:[好东西,值得研究!] 标题:树莓派2代B model 上手初体验,不用显示器,Python GPIO 点亮一颗LED [知识普及] 1,树莓派各版本对比: 2,树莓派2代BModel 主板,图 ...

  9. 我的Go+语言初体验——【三、spx案例测试_许式伟先生推荐补充(附-视频)】

    欢迎大家参与[我的Go+语言初体验]活动: 活动地址:[https://bbs.csdn.net/topics/603464006?utm_source=1594742339] 安装过程博文:[我的G ...

  10. 我的Go+语言初体验——【三、spx案例测试(附-视频)】

    欢迎大家参与[我的Go+语言初体验]活动: 活动地址:[https://bbs.csdn.net/topics/603464006?utm_source=1594742339] 安装过程博文:[我的G ...

最新文章

  1. LSTM入门学习——结合《LSTM模型》文章看
  2. web程序部署常见(404)错误
  3. Razor语法(一)
  4. 使用SoapUI 测试Web Service
  5. VTK:网格之SimpleElevationFilter
  6. SAP C4C Embedded Component里Lead ID和Lead TI页面的关系
  7. android 短信注册,Android注冊短信验证码功能
  8. 设置mysql表myisam_mysql myisam 优化设置设置
  9. android ImageView 之 android:scaleTye=
  10. HTML div 滚动条样式设计
  11. 黔南民族师范学院计算机与信息学院,黔南民族师范学院
  12. java外部类_Java里什么叫内部类什么叫外部类
  13. net core 小坑杂记之配置文件读取(不定期更新)
  14. 梯度投影算法 matlab,梯度投影法及其Matlab实现
  15. php 抽象工厂模式,php设计模式(五)抽象工厂模式
  16. 深入理解java的异常处理机制
  17. 为WINPE加入IMDISK 内存硬盘,虚拟磁盘,加速磁盘访问
  18. 计算机二级c语言选择题资料,计算机二级C语言重点选择题笔试复习资料
  19. python读取odb_python - 从.odb文件中提取von mises应力值 - 堆栈内存溢出
  20. Tegra environment

热门文章

  1. 大家都来学 Java(一)快乐入门
  2. simulation(模拟器) 与 emulation(仿真器)的区别
  3. 重装系统遇上reboot and select proper boot device ...问题解决方案
  4. 理工科er怎么发一作SCI
  5. 【日常训练】Help Far Away Kingdom(Codeforces 99A)
  6. 用计算机套路女孩电话,套路女孩子的情话抖音 套路女朋友的情话大全句子
  7. 封神台SQL注入-宽字节
  8. SQL注入漏洞_封神台第一关
  9. OA 系统与 ERP 的关系,两者是如何对接集成的?
  10. 我不想关注你了,饭否