django和mezzanine搭建博客小站1
django和mezzanine搭建博客小站1
用Django+mezzanine搭建个人博客非常简单,基本上安装和简单的配置就可以完成。
搭建环境
安装Python编译器
sudo apt-get install python
安装pip,virtualenv,virtualenvwrapper
- pip是Python的安装包管理系统- virtualenv是搭建Python的虚拟环境,在同时用Python开发多个项目时,可以把环境相互独立起来- virtualenvwrapper提供了在virtualenv一组快捷命令脚本- fabric是python的一个插件包,用来实现自动化部署非常方便
sudo easy_install pip sudo pip install --upgrade virtualenv virtualenvwrapper sudo pip install --upgrade fabric
使用virtualenvwrapper搭建开发环境
- 创建Python工程虚拟环境:
export WORKON_ENV=~/Env && mkdir -p $WORKON_ENV source /usr/local/bin/virtualenvwrapper.sh mkvirturalenv myprojenv pip install mezzanine
- 创建mezzanine工程
mezzanine-project myproj cd myproj python manage.py createdb
在创建好的工程中注释掉,并打开blog为主页的url,如下:
# HOMEPAGE AS STATIC TEMPLATE# ---------------------------# This pattern simply loads the index.html template. It isn't# commented out like the others, so it's the default. You only need# one homepage pattern, so if you use a different one, comment this# one out.# url("^$", direct_to_template, {"template": "index.html"}, name="home"),# HOMEPAGE AS AN EDITABLE PAGE IN THE PAGE TREE# ---------------------------------------------# This pattern gives us a normal ``Page`` object, so that your# homepage can be managed via the page tree in the admin. If you# use this pattern, you'll need to create a page in the page tree,# and specify its URL (in the Meta Data section) as "/", which# is the value used below in the ``{"slug": "/"}`` part.# Also note that the normal rule of adding a custom# template per page with the template name using the page's slug# doesn't apply here, since we can't have a template called# "/.html" - so for this case, the template "pages/index.html"# should be used if you want to customize the homepage's template.# url("^$", "mezzanine.pages.views.page", {"slug": "/"}, name="home"),# HOMEPAGE FOR A BLOG-ONLY SITE# -----------------------------# This pattern points the homepage to the blog post listing page,# and is useful for sites that are primarily blogs. If you use this# pattern, you'll also need to set BLOG_SLUG = "" in your# ``settings.py`` module, and delete the blog page object from the# page tree in the admin if it was installed.url("^$", "mezzanine.blog.views.blog_post_list", name="home"),
python manage.py runserver 0.0.0.0:8000
然后用浏览器打开http://127.0.0.1:8000就可以看到网站啦。
django和mezzanine搭建博客小站1相关推荐
- Django 搭建博客网站-task03:Models的编写
Django 搭建博客网站 目录 Django 搭建博客网站 前言 一.Models 的编写 二.Blog_config 三.comment 总结 前言 在vscode上连接虚拟机,然后输入命令 bl ...
- Django 搭建博客网站-task02:快速搭建网站
Django 搭建博客网站 目录 Django 搭建博客网站 前言 一.创建 APP 二.将新建的 APP 和项目进行关联 2.1 修改的文件名是 settings.py 2.2 创建超级管理员 2. ...
- Django 搭建博客网站-task01:基础知识
Django 搭建博客网站 目录 Django 搭建博客网站 前言 一.pythonpythonpython 基础知识 二.HTML5HTML5HTML5 基础知识 三.vscodevscodevsc ...
- Django 搭建博客网站-task00:环境配置
Django 搭建博客网站 目录 Django 搭建博客网站 前言 一.软件和平台 二.环境搭建步骤 1.下载 UbuntuUbuntuUbuntu 2.在 vmwarevmwarevmware 上安 ...
- Python 用Django创建自己的博客(2)
####开篇 Python 用Django创建自己的博客(上)中主要记录了项目的创建,项目的文件结构,后台超级用户的创建,数据库的增添数据等,这篇博客的主要是加载html静态文件和显示之间的加载逻辑等 ...
- 使用coding和hexo快速搭建博客
更多精彩内容欢迎访问我的个人博客皮皮猪:http://www.zhsh666.xyz或者http://www.zh66.club期待您的光临哦!我是皮皮猪,感谢各位光临,能为您排忧解难小站深感荣幸!祝 ...
- 使用GitHub Pages搭建博客
2019独角兽企业重金招聘Python工程师标准>>> 使用GitHub Pages搭建博客 14 Jan 2015 新的一年开始,一定要做点美好的事情.GitHub 是一个开源项目 ...
- 轻松搭建博客平台-开源ASP.NET 博客Subtext 的安装
轻松搭建博客平台-开源ASP.NET 博客Subtext 的安装 开源ASP.NET博客Subtext 目前发布了最新版2.0,是基于.Net Framework 2.0/3.0的开源ASP.NE ...
- flask tutorial = make a blog :) flask 搭建博客系统从零开始!
please follow the tutorial from the official site :) http://flask.pocoo.org/docs/ You could download ...
最新文章
- cython安装、使用
- Android构建boot.img:root目录与ramdisk.img的生成
- jenkins集群测试环境原理
- [PLL][PM]锁相环模拟相位解调
- js 定时网页点击_反爬 JS 逆向,扣代码解密分析
- zabbix前端php界面,Zabbix Web UI
- 百度校招历年经典面试题汇总:Java开发岗
- 编程随想 关系图_IT什么岗位比较好找工作?一张金字塔图就能明白
- 首提 Database Plus 新理念,SphereEx 获数百万美元天使融资,接棒 ShardingSphere 打造新型分布式生态
- 基于angular5+ionic3仿照网易云音乐客户端
- 用CSS使DIV水平居中
- mysql collate
- JAVA 读取txt文件内容
- 自然辩证法 题目2
- Letters[Codeforces-43B]
- node2vec 包安装
- CI框架入门中的简单MVC例子
- 福建广电网络显示服务器异常,无法浏览网页故障
- 摄像头采集图像本地HDMI输出延迟测试
- 银行制定快捷支付限额原因
热门文章
- 烧一根不均匀的绳,从头烧到尾总共需要一个小时。现在有若干条材质相同的绳子,问如何用烧绳的方法来计时一个小时十五分钟呢?
- 团员大会如何写组织学习计算机知识,团支部召开接收新团员的支部大会的会议记录怎么写?...
- mysql系列之复制2----主从同步部署
- homelede软路由设置方法_二级lede软路由设置方法,lede设置软路由网卡
- 用ps提取彩色图像的线稿
- 【51单片机快速入门指南】4.2: SSD1306 OLED屏(0.96寸、1.3寸)的I2C控制详解
- 函数柯里化的几个例子
- 数据结构 ADT例子
- jQuery 中ajax回调函数获得的数据格式问题
- 计应121--实训一【李智飞(27号)--李阳持(26号)--胡俊琛(13号)--曹吉(2号)】