打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Mezzanine Django Linux Nginx快速python CMS部署
userphoto

2018.05.12

关注
Posted by:Phodal HuangMarch 1, 2013, 4:28 a.m.

开始之前了解一下Mezzanine是什么:

Mezzanine is a powerful, consistent, and flexible content management platform. Built using the Django framework, Mezzanine provides a simple yet highly extensible architecture that encourages diving in and hacking on the code. Mezzanine is BSD licensed and supported by a diverse and active community.

In some ways, Mezzanine resembles tools such as Wordpress that provide an intuitive interface for managing pages, blog posts, form data, store products, and other types of content. But Mezzanine is also different. Unlike many other platforms that make extensive use of modules or reusable applications, Mezzanine provides most of its functionality by default. This approach yields a more integrated and efficient platform.

这也就是官方的简介,简单地说Mezzanine就是一个基于Django框架的应用,同时他提供了类似于wordpress的功能。换句话说,Mezzanine就是一个wordpress,我们只需要简单的修改就可以部署了。一个新项目创建时的截图,


我们可以看到Mezzanine用作商业的时候是如此的简单明了。

详细可以参考官方网站:http://mezzanine.jupo.org/

Mezzanine快速指引

# Install from PyPI$ pip install mezzanine# Create a project$ mezzanine-project myproject$ cd myproject# Create a database$ python manage.py createdb# Run the web server$ python manage.py runserver


这也就完成了本地开发的第一部。我们可以发现,新建的项目里面我们很难修改主题,如下所示

3240 ./static/media/uploads/gallery3244 ./static/media/uploads3248 ./static/media3252 ./static24 ./deploy8 ./requirements12 ./templates3520 .

可以使用

python manage.py collecttemplates --help


收集templates

因而,我们需要另外的文件,也就是templates,这个没有在需要额外配置。


git clone https://github.com/renyi/mezzanine-themes.git


然后复制目录中的mazzanine_themes/mazzanine_default到templates中,这样就可以修改默认的样式了。

关于部署由于之前静态文件的设置问题,因此也就贴了出来。换句话说,默认的静态文件和Django一样需要修改网站nginx的配置文件,比如我的是www.phodal.com.conf。

 

location /static { autoindex on; alias /home/gmszone/Phodal/static; access_log off; log_not_found off;}

location /robots.txt alias /home/gmszone/Phodal/static; access_log off; log_not_found off;}location /favicon.ico { alias /home/gmszone/Phodal/static/img; access_log off; log_not_found off;}


也就是要由nginx指定static的位置,也就没有那么多,只需要。记得重启一下nginx

alias /home/gmszone/Phodal/static;

至于部署方式可以采用,uWSGI。

安装完uWSGI需要,两个文件以便使之运作。

import os,sys

if not os.path.dirname(file) in sys.path[:1]: sys.path.insert(0, os.path.dirname(file))os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'

from django.core.handlers.wsgi import WSGIHandlerapplication = WSGIHandler()


也就wsgi.py,以及

127.0.0.1:8630 /home/gmszone/Phodal .. wsgi

最后再运行,

uwsgi -x /home/gmszone/Phodal/wsgi.xml

详细可以参照:http://projects.unbit.it/uwsgi/wiki/Example


本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
Mezzanine 教你一分钟搭建Python CMS系统
django
Django+uwsgi+nginx部署项目时遇到的静态资源404的问题。
python-Heroku上的夹层
django怎么重新迁移文件
Django开发常用
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服