Configure Django + WSGI on MacOS

Source: Internet
Author: User

    • Download httpd from httpd.apache.org

    • Need to prepare Xcode, autoconfig, install command tools, default XCODE5 does not provide installation

bogon:kuoxin$ xcode-select--install

    • Modify the directory connection on your Mac, as follows:

bogon:kuoxin$./configure--prefix=/users/kuoxin/workspace/httpd

Note that there are no spaces in the--PREFIX=/USERS/KUOXIN/WORKSPACE/HTTPD

You may encounter the following issue 1:

Configure
Checking for Apr-util ... Yes
Checking for gcc .../applications/xcode.app/contents/developer/toolchains/osx10.9.xctoolchain/usr/bin/cc
Checking whether the C compiler works ... no
Configure:error:in '/users/kuoxin/workspace/httpd-2.4.7 ':
Configure:error:c compiler cannot create executables

Workaround:

bogon:kuoxin$ cd/applications/xcode.app/contents/developer/toolchains/

bogon:kuoxin$ sudo ln-s xcodedefault.xctoolchain osx10.9.xctoolchain

Question 2:

Checking for pcre-config ... false

Configure:error:pcre-config for Libpcre not found. PCRE is required and available from http://pcre.org/

Workaround:

Brew Install Pcre

    • Run make

    • Run make Install

Note: When using apache2.4.x, there is a compatibility problem with the django1.6 currently in use (the current time is 2014-03-24), mainly reflected in:

1. CSRF will appear missing or error problems

2. Print and other log outputs are not valid

Test is normal on 2.2.6.

Install Mod_wsgi

    • Download Mod_wsgi source program version:3.4

    • Configuring the compilation Environment

./configure--with-apxs=/users/kuoxin/workspace/httpd/bin/apxs--with-python=/usr/local/frameworks/ Python.framework/versions/3.3/bin/python3--disable-framework

    • Run make

    • Run sudo make install

Configure Apache httpd

Need to include in http.conf:

LoadModule Wsgi_module modules/mod_wsgi.so

Wsgiscriptalias/'/users/kuoxin/workspace/django/tagweb/tagweb/wsgi.py '

If you have the following problems:

[Tue 05 19:10:51 2009] [ERROR] [Client 127.0.0.1] \

      Raise Importerror, "Could not import mysite.settings '%s ' \
(Is it on Sys.path?) Does It has syntax errors?):%s "\
% (self. Settings_module, E)

Cannot load the project configuration Django_settings_module, which is required to add statements to wsgi.py

Sys.path.append ('/users/kuoxin/workspace/django ')

Sys.path.append ('/users/kuoxin/workspace/django/tagweb ')

Configure Django + WSGI on MacOS

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.