Giter Site home page Giter Site logo

django-blog's Introduction

blog-co

本文 学习、借鉴了 DjangoBlog.

参考网址:http://121.199.27.219:8000/ ,登录:username:dfk,password:dfk123456

主要区别

使用bootstrap4 写的前端样式 后端基本一致,没有那么复杂,例如缓存 压缩等功能都没有加入。 采用 django-elasticsarch-dsl 实现es搜索 加入整体站点缓存 保证访问速度

配置

pip  install -r requirements.txt

配置 email
# 数据库生成
python manage.py makemigrations
python manage.py migrate

python manage.py collectstatic

注意 页面模板 使用了cdn ,避免带宽小的服务器请求页面卡,因此用cdn,可以大大加速页面。 如果你的带宽比较大,可以在templates中 修改base.html 和 users/users_form_base.html 其中 tempmodel中的页面本来是准备做前后端分离的 后台发现不适合就弃用了

如果样式不对,可以设置debug=False

es 生成索引 python manage.py search_index

haystack 生成索引 python manage.py rebuild_index

使用中的 问题

    from django.utils.encoding import force_text, python_2_unicode_compatible
ImportError: cannot import name 'python_2_unicode_compatible' from 'django.utils.encoding' (C:\Envs\blog_co\lib\site-packages\django\utils\encoding.py)

# 首先
pip install six
# 在你自己的虚拟环境下 site-packages有six.py 的目录下
cp six.py django.utils

# 修改 site-packages\haystack\inputs.py
from django.utils.encoding import force_text, python_2_unicode_compatible
# 改为
from django.utils.encoding import force_text
from six import python_2_unicode_compatible

加入了 django-suit==2.0a1 美化后台页面,但是此版本尚未发布,因此安装 pip install https://github.com/darklow/django-suit/tarball/v2

预览

image image image

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.