Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

WHY1121/DjangoBlog

Open more actions menu
 
 

Repository files navigation

DjangoBlog

基于python3.5Django1.10的博客。

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

安装

使用pip安装:
pip install -r 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,
    }
}

创建数据库

终端下执行:

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

创建超级用户

终端下执行:

./manage.py createsuperuser

创建测试数据

终端下执行:

./manage.py create_testdata

开始运行:

执行:
./manage.py runserver

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

About

基于Django的博客系统

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 99.8%
  • Shell 0.2%
Morty Proxy This is a proxified and sanitized view of the page, visit original site.