Coder Social home page Coder Social logo

djangoblog's Introduction

DjangoBlog

基于python3.6Django2.1的博客。

Build Status codecov Requirements Status license GitHub release python3.5 django1.10

主要功能:

  • 文章,页面,分类目录,标签的添加,删除,编辑等。文章及页面支持Markdown,支持代码高亮。
  • 支持文章全文搜索。
  • 完整的评论功能,包括发表回复评论,以及评论的邮件提醒,支持Markdown
  • 侧边栏功能,最新文章,最多阅读,标签云等。
  • 支持Oauth登陆,现已有Google,GitHub,facebook,微博,QQ登录。
  • 支持Memcache缓存,支持缓存自动刷新。
  • 简单的SEO功能,新建文章等会自动通知Google和百度。
  • 集成了简单的图床功能。
  • 集成django-compressor,自动压缩cssjs
  • 网站异常邮件提醒,若有未捕捉到的异常会自动发送提醒邮件。
  • 集成了微信公众号功能,现在可以使用微信公众号来管理你的vps了。

安装

使用pip安装:
pip install -Ur requirements.txt

如果你没有pip,使用如下方式安装:
OS X / Linux 电脑,终端下执行:

curl http://peak.telecommunity.com/dist/ez_setup.py | python
curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python

windows电脑:
下载 http://peak.telecommunity.com/dist/ez_setup.pyhttps://raw.github.com/pypa/pip/master/contrib/get-pip.py 这两个文件,双击运行。

配置

配置都是在setting.py中.部分配置迁移到了后台配置中。

很多setting配置我都是写在环境变量里面的.并没有提交到github中来.例如SECRET_KEY,OAHUTH,mysql以及邮件部分的配置等.你可以直接修改代码成你自己的,或者在环境变量里面加入对应的配置就可以了.

test目录中的文件都是为了travis自动化测试使用的.不用去关注.或者直接使用.这样就可以集成travis自动化测试了.

bin目录是在linux环境中使用Nginx+Gunicorn+virtualenv+supervisor来部署的脚本和Nginx配置文件.可以参考我的文章:

使用Nginx+Gunicorn+virtualenv+supervisor来部署django项目

有详细的部署介绍.

运行

修改DjangoBlog/setting.py 修改数据库配置,如下所示:

 DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'djangoblog',
        'USER': 'root',
        'PASSWORD': 'password',
        'HOST': 'host',
        'PORT': 3306,
    }
}

创建数据库

mysql数据库中执行:

CREATE DATABASE `djangoblog` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci */;

然后终端下执行:

./manage.py makemigrations
./manage.py migrate

创建超级用户

终端下执行:

./manage.py createsuperuser

创建测试数据

终端下执行:

./manage.py create_testdata

收集静态文件

终端下执行:  

./manage.py collectstatic --noinput
./manage.py compress --force

开始运行:

执行: ./manage.py runserver

浏览器打开: http://127.0.0.1:8000/ 就可以看到效果了。

更多配置:

更多配置介绍

问题相关

有任何问题欢迎提Issue,或者将问题描述发送至我邮箱 liangliangyy#gmail.com.我会尽快解答.推荐提交Issue方式.

djangoblog's People

Contributors

liangliangyy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.