django_blog_zinnia 博客部署文档

近期有意把历来文档笔记放到博客中,GitHub上搜了几个基于python的开源博客; 
需求博客功能基本完整,最好django框架;满足前期先快速创建,后期二次开发自定义;
 
一、blog_mini(flask框架)
flask 框架 
 
试用了下,功能偏少,不过用于入门学习flask框架不错;
 
二、开源django cms
1、https://github.com/wagtail/wagtail  需求python 3.4 以上
安装文档
 
以上都是基于django的cms框架,需要学习,非开箱即用,不满足初衷;
 
三、django_blog_zinnia
测试环境部署试用了下,开箱即用,基本功能满足,同时有几款主题可选,又可以在主题基础上自己删减修改,而且后期也支持功能拓展,非常适合初中级进阶学习django框架;
 
1、安装文档
 
2、官方文档并不是很详细,补充几点需要注意的事项;
#step 1 创建虚拟环境
pip install virtualenv
virtualenv blog_zinnia_env
#step 2 安装前置依赖以及博客,可参考官方文档
#需要注意如使用mysql 作为后端数据库
pip install MySQL-python
#同时最新版本移除了python 2.x代码,所以在python2.7 环境部署需要指定版本;
pip install 'django-blog-zinnia == 0.19'
#step 3 创建django项目,编辑配置
django-admin startproject zinnia_blog_demo
#官方文档配置可能是由于django版本差异导致有细节出入,我用的django=1.11,所以在配置的时候仔细点,否则很容易配置错误;(附件会带上我的配置)
#step 4 同步数据库/部署
 python manage.py migrate
#部署  nginx + uwsgi + django  推荐这个,用gunicorn的化会遇到realIP 无法透传的问题;
#注意  需要注意时区设置/字符编码 同数据库一致,否则会遇到字符乱码/国际化问题;
#注意  静态文件收集目录权限/相关路由配置
#=====================================================================
#step 5 以上完成基本就可以完成部署,当然默认主题布局不满意,可以更该官方提供的几个主题;
#官方文档
#http://docs.django-blog-zinnia.com/en/develop/how-to/customize_look_and_feel.html
#step 6 进阶配置
#http://docs.django-blog-zinnia.com/en/develop/getting-started/configuration.html
#注意 xmlrpc功能推荐,方便导入日志
#注意 很讨厌文章预览/继续阅读这个ui设计,所以干脆改了preview.py 关了这个功能;

#step 7  附上个人的settings.py(删减了部分不需要/敏感配置)
 
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
#allow domain
ALLOWED_HOSTS = ['']
SITE_ID = 1
#support markdown
#ZINNIA_MARKUP_LANGUAGE = 'reStructuredText'
#ZINNIA_MARKUP_LANGUAGE = 'textile'
ZINNIA_MARKUP_LANGUAGE = 'markdown'
ZINNIA_MARKDOWN_EXTENSIONS = ['markdown.extensions.extra', 'markdown.extensions.codehilite']
#django_ckeditor support
CKEDITOR_IMAGE_BACKEND = True
#email setup
ZINNIA_MAIL_COMMENT_NOTIFICATION_RECIPIENTS = ['youemail@163.com',]
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.qq.com'
EMAIL_PORT = 465
EMAIL_HOST_USER = 'email@qq.com'
EMAIL_HOST_PASSWORD = ''
EMAIL_USE_SSL = True
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER

#disable continue reading link
ZINNIA_ENTRY_CONTENT_TEMPLATES = [
  ('zinnia/_short_entry_detail.html', 'Short entry template'),
]
# Application definition
INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
# new add
    'zinnia_bootstrap', #Zinnia-theme-bootstrap 
#   'zinnia_foundation',  #zinnia-theme-foundation
    'django.contrib.sites',
    'django_comments',
    'mptt',
    'tagging',
    'zinnia',
    'django.contrib.sitemaps',
    'django_xmlrpc',
    'ckeditor',
    'zinnia_ckeditor',
]
MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'zinnia_blog_demo.urls'
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': False,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
          'zinnia.context_processors.version',  # Optional
            ],
            'loaders': [
               'app_namespace.Loader',
               'django.template.loaders.filesystem.Loader',
               'django.template.loaders.app_directories.Loader',
            ],
        },
    },
]
WSGI_APPLICATION = 'zinnia_blog_demo.wsgi.application'
CKEDITOR_CONFIGS = {
    'default': {
        'toolbar': 'Full',
    },
    'zinnia-content': {
        'toolbar_Zinnia': [
            ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'],
            ['Undo', 'Redo'],
            ['Scayt'],
            ['Link', 'Unlink', 'Anchor'],
            ['Image', 'Table', 'HorizontalRule', 'SpecialChar'],
            ['Source'],
            ['Maximize'],
            '/',
            ['Bold', 'Italic', 'Underline', 'Strike',
             'Subscript', 'Superscript', '-', 'RemoveFormat'],
            ['NumberedList', 'BulletedList', '-',
             'Outdent', 'Indent', '-', 'Blockquote'],
            ['Styles', 'Format'],
        ],
        'toolbar': 'Zinnia',
    },
}
# Database
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
#DATABASES = {
#    'default': {
#        'ENGINE': 'django.db.backends.sqlite3',
#        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
#    }
#}
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'blog',
        'USER': '',
        'PASSWORD': '',
        'HOST': '',
        'port': '3306',
    }
}

# Password validation
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]

#cache
CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
    },
    'comparison': {
        'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
        'LOCATION': 'comparison',
        'TIMEOUT': None,
   }
}
# Internationalization
# https://docs.djangoproject.com/en/1.11/topics/i18n/
LANGUAGE_CODE = 'zh-hans'
TIME_ZONE = 'Asia/Shanghai'
USE_I18N = True
USE_L10N = True
USE_TZ = False

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.11/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = '/var/www/'
MEDIA_ROOT = '/var/www/media'
CKEDITOR_UPLOAD_PATH = '/var/www/upload'
 

Pingbacks已打开。

引用地址

评论
  1. SamGal SamGal 发布于 2021年1月23日 01:47 #

    <a href="http://tadalafilxl.com/">tadalafil generic online</a> <a href="http://indocindrug.com/">indocin cream</a> <a href="http://avanapill.com/">dapoxetine prescription usa</a> <a href="http://ozzpharmacy.com/">reliable canadian online pharmacy</a> <a href="http://phenerganpromethazine.com/">order phenergan online uk</a>

  2. NickGal NickGal 发布于 2021年1月23日 02:18 #

    <a href="http://viagramn.com/">cheap generic viagra india</a> <a href="http://tetracyclinepill.com/">tetracycline without prescription</a> <a href="http://pharmviagra.com/">viagra pfizer</a> <a href="http://bactrimotc.com/">bactrim 800mg 160mg</a> <a href="http://levothyroxinesynthroid.com/">synthroid 0.1 mg daily</a> <a href="http://acycloviral.com/">acyclovir 200mg tablet</a> <a href="http://hydrochlorothiazidepill.com/">hydrochlorothiazide pill</a>

  3. Online Lenders Online Lenders 发布于 2021年1月23日 02:39 #

    <a href="http://secloans.com/">loans for bad credit</a> <a href="http://mtilending.com/">1 hour loans</a> <a href="http://urglending.com/">best loan</a>

  4. AnnaGal AnnaGal 发布于 2021年1月23日 05:07 #

    <a href="http://milpharmacy.com/">discount pharmacy online</a> <a href="http://arimidexanastrozole.com/">arimidex tablets in india</a> <a href="http://propeciaafinasteride.com/">generic finasteride online</a> <a href="http://tadalafilxl.com/">online cialis 20mg</a> <a href="http://cialisdrug.com/">cialis brand name in india</a> <a href="http://finasteridepropecia.com/">cost of propecia generic</a>

  5. NickGal NickGal 发布于 2021年1月23日 05:20 #

    <a href="http://metformindrug.com/">glucophage tablets for sale</a> <a href="http://prednisoneprednisolone.com/">buying prednisone mexico</a> <a href="http://quetiapineseroquel.com/">seroquel xr for depression</a> <a href="http://xtadalafil.com/">canadian pharmacy cheap cialis</a>

  6. Online Payday Loans Online Payday Loans 发布于 2021年1月23日 07:18 #

    <a href="https://urglending.com/">debt consolidation loan</a> <a href="https://mtilending.com/">1500 loan</a> <a href="https://pauloans.com/">high interest loans</a> <a href="https://usploans.com/">financial debt relief</a> <a href="https://otaloans.com/">unsecured personal loan</a> <a href="https://msolending.com/">payday loan lender</a> <a href="https://loandest.com/">payday loans no credit check</a> <a href="https://secloans.com/">bad credit loans direct lenders</a>

  7. JimGal JimGal 发布于 2021年1月23日 09:11 #

    <a href="https://zyloprimallopurinol.com/">allopurinol 200</a> <a href="https://trazodonesari.com/">trazodone discount coupon</a> <a href="https://indocindrug.com/">indocin coupon</a> <a href="https://bactrimotc.com/">buy bactrim online without prescription</a> <a href="https://quetiapineseroquel.com/">seroquel over the counter</a>

  8. JoeGal JoeGal 发布于 2021年1月23日 11:41 #

    <a href="https://upsildenafil.com/">get viagra</a> <a href="https://wellbutrinabupropion.com/">cost of bupropion 150 mg</a> <a href="https://viagrasave.com/">sildenafil generic india</a> <a href="https://finasteridepropecia.com/">propecia india</a> <a href="https://viagrasupp.com/">sildenafil generic 50 mg</a> <a href="https://synthroidlevo.com/">cheapest synthroid prices</a> <a href="https://forcepharmacy.com/">online pharmacy in turkey</a> <a href="https://tetracyclineonline.com/">terramycin cream</a>

  9. Loan Loan 发布于 2021年1月23日 13:25 #

    <a href="https://usploans.com/">christmas loans</a> <a href="https://paydayloansrc.com/">loans with cosigner</a> <a href="https://coenloans.com/">unsecured loans for bad credit</a> <a href="https://pauloans.com/">hard money loans</a> <a href="https://pskloans.com/">cash loans no credit check</a> <a href="https://idnlending.com/">payday advance loans</a> <a href="https://loanprs.com/">affordable payday loans</a> <a href="https://otaloans.com/">bad credit loans monthly payments</a> <a href="https://ssoloans.com/">no credit loans</a> <a href="https://ackloans.com/">loans near me</a>

  10. AnnaGal AnnaGal 发布于 2021年1月23日 13:29 #

    <a href="http://acycloviral.com/">buy zovirax online us</a> <a href="http://lasixfurosemidemed.com/">lasix generic</a> <a href="http://avanapill.com/">dapoxetine brand name in india</a> <a href="http://levothyroxinesynthroid.com/">synthroid best price</a> <a href="http://chloroquinelab.com/">buy plaquenil 200mg</a> <a href="http://atenololtenormin.com/">atenolol 50 tablet</a>

  11. AnnaGal AnnaGal 发布于 2021年1月23日 15:36 #

    <a href="http://doxycyclinerem.com/">canadian pharmacy doxycycline</a> <a href="http://hydrochlorothiazidepill.com/">30 hydrochlorothiazide 25 mg</a> <a href="http://diflucanfluconazol.com/">diflucan online</a> <a href="http://clomidoral.com/">how much is clomid 100mg</a> <a href="http://oipharmacy.com/">best online pharmacy for viagra</a>

  12. SueGal SueGal 发布于 2021年1月23日 15:50 #

    <a href="https://avodartpill.com/">avodart mexico</a> <a href="https://propeciaafinasteride.com/">finpecia 1mg price in india</a> <a href="https://lasixfurosemidepill.com/">furosemide 40 mg over the counter</a> <a href="https://celebrexnsaid.com/">celebrex cost in mexico</a> <a href="https://genuinesildenafil.com/">order generic viagra online canada</a> <a href="https://ozzpharmacy.com/">canadian 24 hour pharmacy</a> <a href="https://yasmintab.com/">yasmin price australia</a> <a href="https://levothyroxinesynthroid.com/">online synthroid</a> <a href="https://metformindrug.com/">metformin hcl 500</a> <a href="https://elitadalafil.com/">no prescription cialis</a>

  13. SamGal SamGal 发布于 2021年1月23日 16:04 #

    <a href="http://wellbutrinbupropionpill.com/">bupropion 225 mg</a> <a href="http://buytretinoinretina.com/">tretinoin 0.025 gel price in india</a> <a href="http://cialisdrug.com/">where to buy cialis online in australia</a> <a href="http://zithromaxazithromycin24.com/">zithromax 500mg</a> <a href="http://hicialis.com/">cialis canada online pharmacy</a>

  14. JaneGal JaneGal 发布于 2021年1月23日 17:39 #

    <a href="https://viagrasildenafilotc.com/">100mg viagra price in india</a>

  15. NickGal NickGal 发布于 2021年1月23日 19:37 #

    <a href="http://phenerganpromethazine.com/">how much is phenergan</a> <a href="http://atenololtenormin.com/">tenormin no prescription</a> <a href="http://yasmintab.com/">can i buy yasmin over the counter</a>

  16. JoeGal JoeGal 发布于 2021年1月23日 19:52 #

    <a href="https://cialistore.com/">cialis 5 mg price</a> <a href="https://pharmviagra.com/">viagra sale</a> <a href="https://tadalafilxl.com/">order cialis cheap</a> <a href="https://hydroxychloroquinrx.com/">cost of plaquenil in mexico</a> <a href="https://celexacitaloprampill.com/">citalopram escitalopram</a> <a href="https://xtadalafil.com/">buy tadalafil 10mg</a> <a href="https://trazodonesari.com/">trazodone for sale online</a> <a href="https://synthroidlevo.com/">synthroid buy online canada</a>

  17. EvaGal EvaGal 发布于 2021年1月23日 20:02 #

    <a href="http://amoxicillindrug.com/">amoxicillin 500mg order online</a>

  18. MiaGal MiaGal 发布于 2021年1月23日 20:21 #

    <a href="https://cymbaltadulox.com/">cymbalta 60 mg tablets</a> <a href="https://avanapill.com/">dapoxetine otc</a> <a href="https://oipharmacy.com/">internet pharmacy manitoba</a> <a href="https://milpharmacy.com/">super saver pharmacy</a> <a href="https://clomidoral.com/">buy clomid india</a>

  19. SamGal SamGal 发布于 2021年1月23日 20:56 #

    <a href="http://bactrimotc.com/">bactrim</a> <a href="http://propeciaafinasteride.com/">propecia online</a> <a href="http://ozzpharmacy.com/">medical pharmacy south</a>

  20. MaryGal MaryGal 发布于 2021年1月23日 21:36 #

    <a href="https://arimidexanastrozole.com/">how to buy arimidex online</a> <a href="https://pharmviagra.com/">viagra pharmacy over the counter</a> <a href="https://buytretinoinretina.com/">retin a 025 cost</a> <a href="https://prednisoloneprednisone.com/">prednisolone 5mg for sale in uk</a> <a href="https://hydroxychloroquinrx.com/">hydroxychloroquine antiviral</a> <a href="https://wellbutrinabupropion.com/">order bupropion uk</a> <a href="https://bactrimotc.com/">bactrim 80 mg</a> <a href="https://metformindrug.com/">metformin hcl 500 mg without prescription</a> <a href="https://lasixfurosemidepill.com/">furosemide 40 mg tablets online</a> <a href="https://tretinoinretinacream.com/">tretinoin 0.05 price</a>

  21. KimGal KimGal 发布于 2021年1月23日 22:25 #

    <a href="https://lasixfurosemidemed.com/">lasix generic</a>

发表评论