Deploy Django on apache Mac OS X(10.9)

1, install Django on Mac OS X

    please refer https://docs.djangoproject.com

2, install wsgi on apache Mac OS X 

    a,  curl -o mod_wsgi.tgz http://modwsgi.googlecode.com/files/mod_wsgi-2.5.tar.gz

    b,  tar zxvf mod_wsgi-2.5.tar.gz

    c,  ./configre

    d, make, make install  # if compiling error, please do the following:

         cd /Applications/Xcode.app/Contents/Developer/Toolchains/

         ln -s XcodeDefault.xctoolchain OSX10.9.xctoolchain

3. cd  /Users/xxx/xxx/workspace

    django-admin.py startproject pydjango

4. vi /etc/apache2/httpd.conf

    LoadModule wsgi_module libexec/apache2/mod_wsgi.so

    ...

    WSGIDaemonProcess pydjango
    WSGIProcessGroup pydjango
    WSGISocketPrefix /private/var/run/wsgi

    WSGIScriptAlias /pydjango /Users/xxx/xxx/workspace/pydjango/pydjango/wsgi.py
    Alias /static /Users/xxx/xxx/xxx

   <Directory /Users/xxx/xxx/workspace/pydjango/pydjango/>
      Order allow,deny
      Allow from all
   </Directory>

5, vi the /Users/xxx/xxx/workspace/pydjango/pydjango/wsgi.py

    insert this line:

        sys.path.append('/Users/xxx/xxx/workspace/pydjango/')

6. sudo apachectl restart

Then, you will see "It works"


版权声明:本文为hujunnt原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。