下載httpd 從 httpd.apache.org python
須要準備xcode, autoconfig,安裝command tools,默認xcode5不提供安裝web
bogon:kuoxin$ xcode-select --installapache
修改mac上的目錄鏈接,修改以下:django
bogon:kuoxin$ ./configure --prefix=/Users/kuoxin/workspace/httpdxcode
注意不能在--prefix=/Users/kuoxin/workspace/httpd 中的存在空格app
可能會遇到以下問題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 executablesui
解決方法:spa
bogon:kuoxin$ cd /Applications/Xcode.app/Contents/Developer/Toolchains/code
bogon:kuoxin$ sudo ln -s XcodeDefault.xctoolchain OSX10.9.xctoolchain
問題2:
checking for pcre-config... false
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
解決方法:
brew install pcre
運行 make
運行 make install
注意:當使用apache2.4.x時,目前使用的django1.6存在兼容問題(當前時間 爲2014-03-24),主要體如今:
1. CSRF 會出現 missing 或錯誤問題
2. print和其餘的log輸出無效
測試在2.2.6上正常
Install mod_wsgi
下載mod_wsgi源程序 version: 3.4
配置編譯環境
./configure --with-apxs=/Users/kuoxin/workspace/httpd/bin/apxs --with-python=/usr/local/Frameworks/Python.framework/Versions/3.3/bin/python3 --disable-framework
運行make
運行sudo make install
配置 Apache httpd
須要在http.conf中加入:
LoadModule wsgi_module modules/mod_wsgi.so
WSGIScriptAlias / '/Users/kuoxin/workspace/django/tagweb/tagweb/wsgi.py’
若是產生以下問題:
[Tue May 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 have syntax errors?): %s" \
% (self.SETTINGS_MODULE, e)
不能加載工程的配置DJANGO_SETTINGS_MODULE,這是須要加入語句到wsgi.py中
sys.path.append('/Users/kuoxin/workspace/django')
sys.path.append('/Users/kuoxin/workspace/django/tagweb’)