zoukankan      html  css  js  c++  java
  • 在MacOS上配置 Django + WSGI

    • 下载httpd 从 httpd.apache.org 

    • 需要准备xcode, autoconfig,安装command tools,默认xcode5不提供安装

              bogon:kuoxin$ xcode-select --install

    • 修改mac上的目录连接,修改如下:

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

                    注意不能在--prefix=/Users/kuoxin/workspace/httpd 中的存在空格

              可能会遇到如下问题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

         

              解决方法:

              bogon:kuoxin$ cd /Applications/Xcode.app/Contents/Developer/Toolchains/

             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’) 

     
  • 相关阅读:
    java实现三角螺旋阵
    java实现人员排日程
    java实现人员排日程
    java实现人员排日程
    java实现人员排日程
    java实现人员排日程
    java实现人民币金额大写
    为什么使用剪切板时都用GlobalAlloc分配内存(历史遗留问题,其实没关系了)
    深入解析Windows窗口创建和消息分发(三个核心问题:怎么将不同的窗口过程勾到一起,将不同的hwnd消息分发给对应的CWnd类去处理,CWnd如何简单有效的去处理消息,由浅入深,非常清楚) good
    Delphi中array of const应用
  • 原文地址:https://www.cnblogs.com/kuoxin/p/4578294.html
Copyright © 2011-2022 走看看