python
python
PHODAL

查看标签 python

开始之前了解一下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/gallery
3244	./static/media/uploads
3248	./static/media
3252	./static
24	./deploy
8	./requirements
12	./templates
3520	.

可以使用

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 WSGIHandler
application = WSGIHandler()

也就wsgi.py,以及

<uwsgi>
    <socket>127.0.0.1:8630</socket>
    <chdir>/home/gmszone/Phodal</chdir>
    <pythonpath>..</pythonpath>
    <module>wsgi</module>
</uwsgi>

最后再运行,

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

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


LAMP是一个缩写,它指一组通常一起使用来运行动态网站或者服务器的自由软件: Linux,操作系统; Apache,网页服务器; MySQL,数据库管理系统(或者数据库服务器); PHP和有时Perl或Python,脚本语言。 虽然这些开放源代码程序本身并不是专门设计成同另几个程序一起工作的,但由于它们的廉价和普遍,这个组合开始流行(大多数Linux发行版本捆绑了这些软件)。当一起使用的时候,它们表现的像一个具有活力的解决方案包。其他的方案包有苹果的WebObjects(最初是应用服务器),Java/J2EE和微软的.NET架构。

开始之前





        如果是类Unix系统,请确定装有GCC,CC或者类似的编译器,当然有其他语言的也可以。比如python


        Windows如果没有GCC,试着使用cygwin安装。


        当以上两个都不想时,试着用python,perl或者其他脚本语言。





开始工作



启动Emacs,用你喜欢或者习惯的方式。Windows可以加emacs加入环境变量,即PATH

由于最近需要,因此就继续上次《android 终端上使用gcc》的后半部分。 (转载请标注:出自gmszone,博客http://blog.csdn.net/gmszone) 大部分方法同那篇相同。 下载python->python-for-android (ps:不要自己造轮子) 解压,复制 注意: 不支持FAT文件系统,所以如果SD卡是FAT系统是不可用的,不可执行

需要安装libffi,python-mini,python。libffi以及python-mini需要安装在python之前

系统框架

本系统采用了两种不同的方案来进行远程的智能小车控制,小车只需要加上个无线模块来接收无线信号,便可以实现远程控制方案。

说说过去的这些事,我有点小怀念第一个语言了:logo,也就是海龟绘图。。。

Feeds

RSS / Atom

最近文章

关于作者

Phodal Huang

Engineer, Consultant, Writer, Designer

ThoughtWorks 技术专家

工程师 / 咨询师 / 作家 / 设计学徒

开源深度爱好者

出版有《前端架构:从入门到微前端》、《自己动手设计物联网》、《全栈应用开发:精益实践》

联系我: h@phodal.com

微信公众号: 最新技术分享

存档

分类

标签

作者