The section on apache modules for dynamic websites was quite out of

date.  Add sections on Ruby on Rails and Django.
This commit is contained in:
Murray Stokely 2008-03-28 06:03:53 +00:00
parent 80bd846180
commit 3185a3abe5
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=31753

View file

@ -4054,18 +4054,101 @@ DocumentRoot /www/someotherdomain.tld
</sect3>
<sect3>
<title>Dynamic Websites with Perl &amp; PHP</title>
<para>In the past few years, more businesses have turned to the
<title>Language Bindings</title>
<para>There are Apache modules for most major scripting
languages. These modules typically make it possible to
write <application>Apache</application> modules entirely in
a scripting language. They are also often used as a
persistent interpreter embedded into the server that avoids
the overhead of starting an external interpreter and the
startup-time penalty for dynamic websites, as described in
the next section.</para>
</sect3>
</sect2>
<sect2>
<title>Dynamic Websites</title>
<indexterm><primary>web servers</primary>
<secondary>dynamic</secondary></indexterm>
<para>In the last decade, more businesses have turned to the
Internet in order to enhance their revenue and increase
exposure. This has also increased the need for interactive
web content. While some companies, such as &microsoft;, have
introduced solutions into their proprietary products, the
open source community answered the call. Two options for
dynamic web content include
<application>mod_perl</application> &amp;
web content. While some companies, such as &microsoft;,
have introduced solutions into their proprietary products,
the open source community answered the call. Modern options
for dynamic web content include Django, Ruby on Rails,
<application>mod_perl</application>, and
<application>mod_php</application>.</para>
<sect4>
<sect3>
<title>Django</title>
<indexterm><primary>Python</primary></indexterm>
<indexterm><primary>Django</primary></indexterm>
<para>Django is a BSD licensed framework designed to allow
developers to write high performance, elegant web
applications quickly. It provides an object-relational
mapper so that data types are developed as Python objects,
and a rich dynamic database-access API is provided for those
objects without the developer ever having to write SQL. It
also provides an extensible template system so that the
logic of the application is separated from the HTML
presentation.</para>
<para>Django depends on <application>mod_python</application>,
<application>Apache</application>, and an SQL database
engine of your choice. The FreeBSD Port will install all of
these pre-requisites for you with the appropriate flags.</para>
<example id="network-www-django-install">
<title>Installing Django with Apache2, mod_python3, and PostgreSQL</title>
<screen>&prompt.root; <userinput>cd /usr/ports/www/py-django; make all install clean -DWITH_MOD_PYTHON3 -DWITH_POSTGRESQL</userinput></screen>
</example>
<para>Once Django and these pre-requisites are installed, you
will need to create a Django project directory and then
configure Apache to use the embedded Python interpreter to
call your application for specific URLs on your site.</para>
<example id="network-www-django-apache-config">
<title>Apache Configuration for Django/mod_python</title>
<para>You will need to add a line to the apache
<filename>httpd.conf</filename> file to configure Apache
to pass requests for certain URLs to your web
application:</para>
<screen>&lt;Location "/"&gt;
SetHandler python-program
PythonPath "['/dir/to/your/django/packages/'] + sys.path"
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonAutoReload On
PythonDebug On
&lt;/Location&gt;</screen>
</example>
</sect3>
<sect3>
<title>Ruby on Rails</title>
<indexterm><primary>Ruby on Rails</primary></indexterm>
<para>Ruby on Rails is another open source web framework that
provides a full development stack and is optimized to make
web developers more productive and capable of writing
powerful applications quickly. It can be installed easily
from the ports system.</para>
<screen>&prompt.root; <userinput>cd /usr/ports/www/rubygem-rails; make all install clean</userinput></screen>
</sect3>
<sect3>
<title>mod_perl</title>
<indexterm>
@ -4093,10 +4176,10 @@ DocumentRoot /www/someotherdomain.tld
<filename role="package">www/apache13-modperl</filename>.
<application>mod_perl</application> 2.0 is avaliable in
<filename role="package">www/mod_perl2</filename>.</para>
</sect4>
</sect3>
<sect4>
<sect4info>
<sect3>
<sect3info>
<authorgroup>
<author>
<firstname>Tom</firstname>
@ -4104,7 +4187,7 @@ DocumentRoot /www/someotherdomain.tld
<contrib>Written by </contrib>
</author>
</authorgroup>
</sect4info>
</sect3info>
<title>mod_php</title>
<indexterm>
@ -4203,7 +4286,6 @@ DocumentRoot /www/someotherdomain.tld
pick up the new configuration changes:</para>
<screen>&prompt.root; <userinput>apachectl graceful</userinput></screen>
</sect4>
</sect3>
</sect2>
</sect1>