Django Mezzanine uwsgi nginx Configuration

Source: Internet
Author: User
1, Mezzanine Introduction

Mezzanine is an application based on the Django framework, which can be consulted in detail on the official website: http://mezzanine.jupo.org/

2, Mezzanine Installation Guide:

# Install from PyPI  $ pip Install Mezzanine     # Create a project  $ mezzanine-project myproject  $ cd MYPROJEC T     # Create a database  $ python manage.py createdb     # Run The Web server  $ python manage.py runserver

New project If you want to modify the topic, refer to: Https://github.com/renyi/mezzanine-themes.git

3, modify the Nginx configuration file

Modify the configuration file nginx.conf in the Conf directory under your Nginx installation directory.

About deployment due to previous static file setup issues

   CD  /usr/local/nginx/conf/  gedit  nginx.conf

Add the following content:

Be careful to modify the path of your corresponding 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;    }       }

As for the deployment method can be adopted, uwsgi,http://projects.unbit.it/downloads/.

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

Install UWSGI.

Create a new file in your project directory django_wsgi.py

Add the following content:

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

New File Django.xml

Add the following, and note that you are modifying the path to yourself:

 
         
  
   
    
   127.0.0.1:8000
  
          
  
   
    
   true
  
          
  
   
    
   /home/daniel/myblog
  
            
  
   
    
   ..
  
         
  
   
    
   django_wsgi.py
  
          
  
   
    
   true
  
      
 
  

Last run: Wsgi-x wsgi.xml

This is configured well, in the browser input: http://localhost:8080/

is not able to browse your site.

Specific configuration can be found in my project's related configuration

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


Article turned from: http://blog.csdn.net/daniel_ustc/article/details/8855303

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