Code

Changes between Version 7 and Version 8 of OsxFcgi


Ignore:
Timestamp:
10/24/05 10:54:06 (8 years ago)
Author:
captnswing
Comment:

massaging...

Legend:

Unmodified
Added
Removed
Modified
  • OsxFcgi

    v7 v8  
    11== Getting Django to work with Apache 1.3 and FCGI on Mac OS X == 
    22 
    3 On OS X, using django with mod_python requires you to install Apache2, which involves quite a bit of extra effort to get it right. So for most of us Mac users, since Apache 1.3 is already installed, this is not an option. At the same time, the information contained here  
     3If you want to use django with mod_python on OS X, you need to install Apache2 first. This involves quite a bit of extra effort and can be difficult to get right. But since Apache 1.3 comes already installed on all OS X systems, for most Mac users, this won't be the best option. The alternative to mod_python and Apache2 is to use FCGI with Apache 1.3, but with the information provided here  
    44[http://hugo.muensterland.org/2005/08/03/django-apache-and-fcgi/ Django, Apache and FCGI] and here 
    5 [https://simon.bofh.ms/cgi-bin/trac-django-projects.cgi/wiki/DjangoFcgi django projects] is a bit incomplete from a Mac users perspective. 
     5[https://simon.bofh.ms/cgi-bin/trac-django-projects.cgi/wiki/DjangoFcgi django projects] it isn't quite so simple to get going either. 
    66 
    7 So here is a summary of the steps needed to get Django working with FCGI and Apache 1.3 on Mac OS X: 
    8 It assumes that your django project is called ''myproject''. Adjust the following accordingly. 
     7Hence a quick summary of the steps needed to get Django working with FCGI and Apache 1.3 on Mac OS X. It assumes that your django project is called ''myproject''. Adjust the following accordingly. 
    98 
    109 
    1110=== install django-fcgi.py ===  
    1211 
    13 download the ''django-fcgi-py'' script and install it in ''/usr/local/bin'' 
     12Get the ''django-fcgi.py'' script and put it in ''/usr/local/bin''. 
    1413{{{ 
    1514svn co https://simon.bofh.ms/django-projects/stuff stuff 
     
    2221=== install mod_fastcgi ===  
    2322 
    24 straightforward apache module install 
    2523{{{ 
    2624curl -O http://www.fastcgi.com/dist/mod_fastcgi-2.4.2.tar.gz 
     
    3533=== install latest flup ===  
    3634 
    37 again, this is straightforward 
    3835{{{ 
    3936svn co http://svn.saddi.com/flup/trunk flup 
     
    4441 
    4542 
    46 === change /etc/httpd/httpd.conf ===  
     43=== change /etc/hosts and /etc/httpd/httpd.conf ===  
    4744 
    48 Use your favorite editor to add the following lines at the end of ''httpd.conf'': 
     45Use your favorite editor to change ''/etc/hosts'', adding a 'django.loc' alias for localhost. This is useful for development. 
     46{{{ 
     47127.0.0.1       localhost       django.loc 
     48}}} 
     49 
     50 
     51Now, add the following lines at the end of ''httpd.conf'': 
    4952{{{ 
    5053FastCgiExternalServer /Library/WebServer/Documents/django.fcgi -host 127.0.0.1:8882 
     
    6265You'll need such a RewriteRule line for every application you want to access (if your application name is something else than ''myapp'', make sure to change that above). 
    6366 
    64 === change /etc/hosts ===  
     67Finally, give apache a restart with 'sudo apachectl restart' to make these changes effective. 
    6568 
    66 add a 'django.loc' hostname, good for development 
    67 {{{ 
    68 127.0.0.1       localhost       django.loc 
    69 }}} 
    70 give apache a restart with 'sudo apachectl restart' 
    7169 
    7270=== link media files into docroot ===  
    7371 
    74 so the django admin templates and style sheets are found. 
     72This will make the django admin templates and style sheets available to Apache. 
    7573First, change into your ''django_src'' directory. And then: 
    7674{{{ 
     
    8381}}} 
    8482 
    85 Basically, ''import myproject'' should work now on the python prompt 
     83Basically, ''import myproject'' should work now on the python prompt. 
    8684 
    8785 
    8886=== starting and stopping ===  
    8987 
    90 the following commands start the fcgi server, and stop it as well 
     88Use the following commands to start and stop the fcgi server: 
    9189{{{ 
    92 django-fcgi.py --settings=myproject.settings --host 127.0.0.1 --port 8882 --daemon 
    93 kill `ps auxww | grep [d]jango-fcgi | awk '{print $2}'` 
     90start:  django-fcgi.py --settings=myproject.settings --host 127.0.0.1 --port 8882 --daemon 
     91 
     92stop:   kill `ps auxww | grep [d]jango-fcgi | awk '{print $2}'` 
    9493}}} 
    9594 
    96 Note that the port-number in the call to django-fcgi.py has to match the number that you specified in ''/etc/httpd/httpd.conf''. 
     95Note that the port-number in the call to django-fcgi.py has to match the number that you specified in ''/etc/httpd/httpd.conf'' above. Also, the settings file argument must refer to your project settings (here: ''myproject''). 
    9796 
    9897 
    9998=== finished! === 
    10099 
    101 with Apache and django-fcgi.py both running, you should be able to access the django admin at [http://django.loc/admin http://django.loc/admin]. Enjoy. 
     100With both Apache and django-fcgi.py running, you should now be able to access the django admin application at [http://django.loc/admin http://django.loc/admin]. Enjoy. 
    102101 
    103102