Django mezzanine uwsgi nginx Configuration

Source: Internet
Author: User

1. Mezzanine Introduction

Mezzanine is an application based on Django framework, For details, refer to the official website: http://mezzanine.jupo.org/

2. Mezzanine Installation 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

The new project, if you want to modify a topic, can refer to: https://github.com/renyi/mezzanine-themes.git

3. Modify the nginx configuration file

Go to the conf directory under your nginx installation directory and modify the configuration file nginx. conf.

* *** About how to configure static files during deployment

cd  /usr/local/nginx/conf/gedit  nginx.conf

Add the following content:

Make sure to modify the path of your project, such as Alias/home/Daniel/myblog/static;

 server { listen  8080;        server_name 123456;           location / {  root /home/daniel/myblog/;          uwsgi_pass   127.0.0.1:8000;           include     uwsgi_params;  }location /static {      autoindex on;      alias /home/daniel/myblog/static;      access_log off;      log_not_found off;  }  location /robots.txt {      alias /home/daniel/myblog/static;        access_log off;      log_not_found off;  }location /favicon.ico {      alias /home/daniel/myblog/static/img;      access_log off;      log_not_found off;  }  }  

 

The deployment method can be uwsgi, http://projects.unbit.it/downloads /.

tar zxvf uwsgi-latest.tar.gz cd uwsgi-1.2.6 make cp uwsgi  /usr/sbin/uwsgi

After uwsgi is installed.

Create the file django_wsgi.py in your project directory.

Add the following content:

#!/usr/bin/env python # coding: utf-8import 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()

Create File Django. xml

Add the following content and change it to your own path:

 

<uwsgi>     <socket>127.0.0.1:8000</socket> <master>true</master> <chdir>/home/daniel/myblog</chdir>   <pythonpath>..</pythonpath><wsgi-file>django_wsgi.py</wsgi-file> <enable-threads>true</enable-threads> </uwsgi>

Last run: wsgi-x wsgi. xml

This is configured. Enter http: // localhost: 8080/in the browser/

Is it possible to browse your site.

For specific configuration, see related configuration in my project.

Https://github.com/ustcdane/Mezzanine-uwsgi-nginx

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.