Mezzanine Django Linux Nginx quick python CMS deployment

Source: Internet
Author: User

Before getting started, let's take a look at what Mezzanine is:

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 extends 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.

This is the official introduction. In short, Mezzanine is an application based on the Django framework. It also provides features similar to wordpress. In other words, Mezzanine is a wordpress, which can be deployed with simple modifications. When a new project is created,

We can see that Mezzanine is so simple and clear when used as a business.

For details, refer to the official website: http://mezzanine.jupo.org/

Mezzanine Quick Guide

# 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

This completes the first part of local development. We can find that it is difficult to modify the topic in the new project, as shown below:

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

Available

python manage.py collecttemplates --help

Collect templates

Therefore, we need another file, namely, templates, which does not require additional configuration.

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

Copy mazzanine_themes/mazzanine_default in the directory to templates to modify the default style.

Due to the previous static file settings, the deployment is also pasted. In other words, the default static file, like Django, needs to modify the nginx configuration file of the website, for example, www.phodal.com. conf.

 

location /static {autoindex on;alias /home/gmszone/Phodal/static;access_log off;log_not_found off;}location /robots.txtalias /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;}


That is, to specify the static location by nginx, there are not so many, just need. Remember to restart nginx

alias /home/gmszone/Phodal/static;


You can use uWSGI for deployment.

After uWSGI is installed, you need two files to make it work.

import os,sysif 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()


That is, wsgi. py, and

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


Run again,

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


For details, refer to: http://projects.unbit.it/uwsgi/wiki/Example

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.