Django + mod_wsig + Apache build production environment

Source: Internet
Author: User

1: Install mod_wsgi: Download mod_wsgi.so and put it in the modules (in the Apache installation path) folder.

: Http://www.lfd.uci.edu /~ Gohlke/pythonlibs/# mod_wsgi

** Note: Remember when selecting: The mod_wsgi-3.5.ap22.win32-py3.3.zip refers to the corresponding apache version is 22, Win32 is not the number of your system, but the number of Apache. You can see in the logs folder that python is version 3.3.

Find the loadmodule in the Apache configuration file (CONF/httpd. conf) and add:

Loadmodule wsgi_module modules/mod_wsgi.so

The preliminary configuration of Apache is successful. Start the browser and enter http: 127.0.0.1: 80. The first step is successful. Congratulations! proceed to the next step.

2. There is a wsgi. py file under proj (project), which is used for configuration.

The content is:

# The green part does not exist in wsgi. py. We need to add it.

Import OS

Import sys

From Django. Core. wsgi import get_wsgi_application

SYS. Path. append (r 'e: \ project \ proj ') # Put the project path here

SYS. Path. append (r'e: \ project \ proj \ searchapp') # Put the application path here

OS. Environ. setdefault ("django_settings_module", "proj. Settings ")

Application = get_wsgi_application ()

 

3 In HTTP. conf: Write

Wsgiscriptalias/"E:/project/proj/wsgi. py" # This path is the absolute path of your wsgi. py file.

Note: The '/' in the middle is indispensable; otherwise, an error is reported.

 

 

Django + mod_wsig + Apache build production environment

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.