Django-blog-zinnia初体验(一)
来源:互联网 发布:优站目录源码 编辑:程序博客网 时间:2024/06/10 01:47
一、简介
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初次接触
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',)
- Django-blog-zinnia初体验(一)
- python django-blog-zinnia
- django-blog-zinnia添加文本编辑器ckeditor
- 使用 django-blog-zinnia 搭建个人博客
- python之django-blog-zinnia 搭建个人博客
- Zinnia - Django 博客框架
- Django初体验
- Django+Hybrid 初体验
- django初体验
- Django一个BLOG实现(参考)(一)
- Blog初体验
- 跟着Django手册建立Blog(一)
- django初体验-网站sample
- Django——初体验
- Blog初体验!---什么是幸福?
- CSDN的Blog初体验!
- 我的 BLOG 初体验
- Yii blog 之初体验
- C++ DirectX 游戏开发初级视频教程 19 资源下载链接
- 昨日参加hackerrank一比赛总结
- 年初英语
- HDU2896.病毒侵袭中【MLE和PE的原因】【AC自动机模板题】
- Redis源码解析:05跳跃表
- Django-blog-zinnia初体验(一)
- HDOJ 5615-Jam's math problem【数学】
- 一起talk C栗子吧(第一百一十五回:C语言实例--线程同步之互斥量一)
- Oracle单节点开启关闭归档日志
- 2016太原网络营销师郭文军分享网站中如何合理布局关键词?
- ios-提升之【1】-UIApplication
- HDOJ 5616-Jam's balance【模拟】
- RadioGroup方法总结
- Eclipse下通过Maven的Jetty插件运行Web工程的配置