Revision [1670]

Last edited on 2010-01-15 20:35:20 by KevinTurner [categorize]
Additions:
=====Using Django on ASO with FastCGI=====
====Introduction====
After much looking around at various resources and my experience on getting Django FCGI working, I thought I would post an up-to-date guide on getting Django working with ASO. Hopefully this guide will be a benefit for the ASO community.
This guide will be aimed towards Tiny account holders, but to anyone else who has more storage to play with, they can tweak some of the steps to their liking.
This guides differs in such that the setup is as close to the recommended setup on Django's deployment page for [[http://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/#running-django-on-a-shared-hosting-provider-with-apache Running Django on a shared-hosting provider with Apache]].
====Assumptions====
This guide assumes that the reader is familiar with Linux and its basic commands, a terminal, SSH, and have basic programming knowledge, preferably (hopefully) in Python. If you are confused at this point about what I am talking about, then it may be a good idea to read up on what all of this is so that you don't feel like a deer in the headlights as you proceed. Additionally, knowing a decent text editor (emacs, vim, nano, etc) is a must.
I won't go through a super detailed tutorial on some of these "basic" things such as logging into your account through SSH, changing to every single directory, and anything similar. If something is severely left out or makes the guide a complete loss, please edit where necessary.
====Requirements====
To perform anything that will be shown in the rest of this guide you **must** have shell/ssh access on your account. This can be done by submitting a ticket.
Django is not really picky on what version Python you are using since the core components require anything between 2.3-2.6. However, any modules from the django.contrib package may require more recent versions of Python. I would **highly** recommend either //Python2.5// or //Python2.6// since that is better supported overall by Django and any other contributing modules. You may request a particular version to be installed by submitting a ticket. You **should not** request Python3.x installed since Django does not support this version due to backwards compatibility support from Python. More information can be found at the Django [[http://docs.djangoproject.com/en/dev/faq/install/#faq-install install faq]] for the curious.
If you plan on using MySQL as your database back-end, you might as well submit a ticket for the MySQLdb module for the version of Python that you have installed or requested.
====Preparation====
While you are waiting for your ticket(s) to be resolved or if they are done already, we can take care of these next steps that don't require the packages being installed. If you don't have shell/ssh access, then I guess just sit tight.
First, we will create a directory where we will store Python packages/modules that we will be installing or symlink'ing to. You may set up your directories wherever you like, just make sure to keep that in mind through the rest of the guide when setting up environment variables and when I refer to this directory. I prefer to create a directory structure similar to "/usr/local" in my home directory:
%%
mkdir -p ~/local/lib/python2.X/site-packages
%%
Replace "X" with your Python version that is (will be installed).
To set up your shell/ssh environment, we will edit your //.bashrc// and //.bash_profile//. The aliases and environment variables set in these files will make working with your Python and Django installs through the SSH simpler. First, open up //.bashrc// and add the following line:
%%(bash)
alias python=python2.X
%%
Replace "X" with your Python version that is (will be) installed. This will execute the correct Python version you wish to use whenever you run "python" on the command line for the interpreter or when running scripts.
Now open //.bash_profile// to set up two environment variables so that commands become available on the command line once Django is installed and to add to the path where Python looks for installed packages/modules. Please add the following two lines:
%%(bash)
export PATH=$PATH:$HOME/local/lib/python2.X/site-packages/django/bin
export PYTHONPATH=$PYTHONPATH:$HOME/local/lib/python2.X/site-packages
%%
Replace "X" with your Python version that is (will be) installed. [b]NOTE:[/b] If you changed where you directories are for locally installed Python packages, these lines will differ.
====Tickets Resolved & Prep-Work Done?====
Lets take a quick break and test what we have done thus far. The easiest way is to logout and back into your shell OR if you don't feel like doing that, you can source the two files we edited so that they become in-effect:
%%(bash)
source ~/.bash_profile
source ~/.bashrc
%%
Now you should be able to execute "python" and see something similar:
%%(bash)
username@host [~]# python
Python 2.6.2 (r262:71600, Aug 5 2009, 13:32:15)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
%%
Verify your Python version and type Ctrl-D to exit the Python interpreter.
**WARNING: From now on, I am going to be displaying code that uses Python 2.6, so just be aware and change the Python version when changing directories**.
====Installing Django====
There are two typical ways of installing Django: Release or latest development version. Which to choose? I have always used the development version and have never had any problems. You could also download the latest release tarball too. If you do decide to use the tarball release, just keep in mind some of these steps are irrelevant and/or different.
Now Tiny accounts are only limited to 75Mb of space and performing a regular [[http://subversion.tigris.org/ Subversion]] checkout takes just over 74Mb of space. Unacceptable. Seems like we are hosed, right? Luckily, we can //export// just the folder and set of files we need to get Django up and running. The rest of the checkout has a lot of bloat for keeping all the revision history, documentation, etc that is entirely unnecessary and can be found online where you can [[http://code.djangoproject.com/browser/django/trunk browse the source]]. This leaves the Django code at approximately 19Mb; definitely beats ~74Mb :D.
Ready? Great! So now lets install django into that site-packages directory we created earlier:
%%(bash)
cd ~/local/lib/python2.6/site-packages/
svn export http://code.djangoproject.com/svn/django/trunk/django django
# to update your Django code once in the site-packages directory
svn export --force http://code.djangoproject.com/svn/django/trunk/django django
%%
This will export the core django code into the "site-package" directory.
To test that you can use Django properly you should execute and see the following:
%%(bash)
username@host [~/]# django-admin.py
Type 'django-admin.py help' for usage.
username@host [~/]# python
Python 2.6.2 (r262:71600, Aug 5 2009, 13:32:15)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>>
%%
This is good, close out of the interpreter and Django is installed.
However, if something goes wrong:
%%(bash)
username@host [~/]# django-admin.py
-jailshell: django-admin.py: command not found
# or
>>> import django
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named django
>>>
%%
Check in //.bash_profile// that your PATH includes the where the django/bin directory is and that your PYTHONPATH includes the directory in which the //./django// directory is located. If your //.bash_profile// appears correct, check the actual environment:
%%(bash)
echo $PATH
echo $PYTHONPATH
%%
If the paths don't appear on any of the echo outputs, make sure that you source'd the bash profile file or just logout and log back into your shell.
====Create a Django Project====
Now, I won't go through all the steps of starting off your Django project, but I will do the bare minimum to get the basics up and running. Now I prefer to have a directory that holds my Django project, media folder, scripts, and templates:
%%(bash)
cd ~/
mkdir website
cd website
# replace 'myproj' with whatever your project name
django-admin.py startproject myproj
# this is up to you, but it is nice to keep everything contained
mkdir media
mkdir scripts
mkdir templates
# we now have
# ~/website
# ./media
# ./mpyroj
# ./scripts
# ./templates
%%
The last things that needs to get done is create a symlink to your project in the //./site-packages// directory so Python know where to find your project. **Remember:** we added the //./site-packages// to our PYTHONPATH so Python knows where to find everything; nice!
%%(bash)
cd ~/local/lib/python2.6/site-packages
ln -s ~/website/myproj
%%
Quick check that we can import our project in Python:
%%(python)
python
Python 2.6.2 (r262:71600, Aug 5 2009, 13:32:15)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import myproj
>>>
%%
No import errors? Great, lets move on!
====Install Flup====
Recall the link referencing how Django is preferred to be installed in the beginning? Well, using FCGI the "Django way" requires Flup to be installed. It may be a good idea to check the [[http://trac.saddi.com/flup Flup website]] to see what the latest release is.
%%(bash)
cd ~/
wget http://www.saddi.com/software/flup/dist/flup-1.0.2.tar.gz
tar xzvf flup-1.0.2.tar.gz
cd flup-1.0.2
cp -r flup ~/local/lib/python2.6/site-packages/
%%
Quick check that we can import flup in Python:
%%(python)
python
Python 2.6.2 (r262:71600, Aug 5 2009, 13:32:15)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import flup
>>>
%%
No import errors? Great, lets move on!
====FCGI on Shared Hosting====
We are almost at the end of our journey. First we need to create a simple FCGI program in our //~/public_html// that will be executed that will dispatch web requests to your Django site. First create/open a file in your favorite editor "dispatch.fcgi" in your //~/public_html// directory:
%%(python)
#!/usr/local/bin/python2.6
import sys
import os
sys.path.append('/home/username/local/lib/python2.6/site-packages')
os.environ['DJANGO_SETTINGS_MODULE'] = 'myproj.settings'
from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")
%%
A few things to note. Replace the first line to where your python2.X is installed. You can check by executing `which python2.X` in case you aren't sure. Change the "username" to your login name. Finally, change "myproj.settings" to your "yourprojname.settings".
Also we need to make sure that this file is executable so that it can be run by Apache:
%%(bash)
chmod 755 dispatch.fcgi
%%
We can test the script by running:
%%(bash)
./dispatch.fcgi
%%
You should see HTML output the console! If so, we are in good shape.
If something goes wrong, make sure that FCGI is working by looking at the [[http://wiki.asmallorange.com/HOWTODjangoFastCGI Testing FastCGI]] on this ASO wiki page for making sure FCGI is working on your shared hosting.
====Modify .htaccess====
In your //~/public_html// directory, we just need to modify the //.htaccess// file so that web requests are dispatched to your dispatch.fcgi script.
Open up //~/public_html/.htaccess// and the entire file should be:
%%(htaccess)
AddHandler fastcgi-script .fcgi
RewriteEngine On # rewrite url request enabled
RewriteCond %{REQUEST_FILENAME} !-f # if the FILENAME requested isn't an actual file, perform the next command
RewriteRule ^(.*)$ dispatch.fcgi/$1 [QSA,L] # send requested urn to the dispatch.fcgi to be processed
%%
====Test your new Website====
Go to http://www.yourwebsite.com!
Hopefully you should see the Django welcome page because you haven't created anything yet on your site. Enjoy!
When you make changes to your code and would like to see them on your site, just update the timestamp of your //dispatch.fcgi// file and Apache will restart your Django application for you.
%%(bash)
touch mysite.fcgi
%%
====Admin Media====
If you run into trouble with media not showing up in the admin side of your app (no css, images, etc), you may need to link to them from your site's document root:
1) cd to your document root (i.e. //~/public_html//)
1) add a symlink to the django admin media:
%%(bash)
$ ln -s /home/username/local/lib/python2.x/site-packages/django/contrib/admin/media media
%%
More info from the official Django documentation here:
- [[http://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/#serving-admin-media-files]]
- [[http://docs.djangoproject.com/en/dev/howto/deployment/modpython/#id3]]
====Conclusion====
I hope this guide is helpful and that the ASO community may benefit from this wealth of information.
====Notes====
To make sure no one else on your shard hosting server can view your password in your project's [i]./settings.py[/i] file, we should change the permissions so only you can view and edit this file:
%%(bash)
chmod 600 ~/website/myproj/settings.py
%%
CategoryPython
Deletions:
=====Using Django on ASO with FastCGI=====

====Introduction====
After much looking around at various resources and my experience on getting Django FCGI working, I thought I would post an up-to-date guide on getting Django working with ASO. Hopefully this guide will be a benefit for the ASO community.

This guide will be aimed towards Tiny account holders, but to anyone else who has more storage to play with, they can tweak some of the steps to their liking.

This guides differs in such that the setup is as close to the recommended setup on Django's deployment page for [[http://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/#running-django-on-a-shared-hosting-provider-with-apache Running Django on a shared-hosting provider with Apache]].

====Assumptions====
This guide assumes that the reader is familiar with Linux and its basic commands, a terminal, SSH, and have basic programming knowledge, preferably (hopefully) in Python. If you are confused at this point about what I am talking about, then it may be a good idea to read up on what all of this is so that you don't feel like a deer in the headlights as you proceed. Additionally, knowing a decent text editor (emacs, vim, nano, etc) is a must.

I won't go through a super detailed tutorial on some of these "basic" things such as logging into your account through SSH, changing to every single directory, and anything similar. If something is severely left out or makes the guide a complete loss, please edit where necessary.

====Requirements====
To perform anything that will be shown in the rest of this guide you **must** have shell/ssh access on your account. This can be done by submitting a ticket.

Django is not really picky on what version Python you are using since the core components require anything between 2.3-2.6. However, any modules from the django.contrib package may require more recent versions of Python. I would **highly** recommend either //Python2.5// or //Python2.6// since that is better supported overall by Django and any other contributing modules. You may request a particular version to be installed by submitting a ticket. You **should not** request Python3.x installed since Django does not support this version due to backwards compatibility support from Python. More information can be found at the Django [[http://docs.djangoproject.com/en/dev/faq/install/#faq-install install faq]] for the curious.

If you plan on using MySQL as your database back-end, you might as well submit a ticket for the MySQLdb module for the version of Python that you have installed or requested.

====Preparation====
While you are waiting for your ticket(s) to be resolved or if they are done already, we can take care of these next steps that don't require the packages being installed. If you don't have shell/ssh access, then I guess just sit tight.

First, we will create a directory where we will store Python packages/modules that we will be installing or symlink'ing to. You may set up your directories wherever you like, just make sure to keep that in mind through the rest of the guide when setting up environment variables and when I refer to this directory. I prefer to create a directory structure similar to "/usr/local" in my home directory:
%%
mkdir -p ~/local/lib/python2.X/site-packages
%%
Replace "X" with your Python version that is (will be installed).

To set up your shell/ssh environment, we will edit your //.bashrc// and //.bash_profile//. The aliases and environment variables set in these files will make working with your Python and Django installs through the SSH simpler. First, open up //.bashrc// and add the following line:
%%(bash)
alias python=python2.X
%%
Replace "X" with your Python version that is (will be) installed. This will execute the correct Python version you wish to use whenever you run "python" on the command line for the interpreter or when running scripts.

Now open //.bash_profile// to set up two environment variables so that commands become available on the command line once Django is installed and to add to the path where Python looks for installed packages/modules. Please add the following two lines:
%%(bash)
export PATH=$PATH:$HOME/local/lib/python2.X/site-packages/django/bin
export PYTHONPATH=$PYTHONPATH:$HOME/local/lib/python2.X/site-packages
%%
Replace "X" with your Python version that is (will be) installed. [b]NOTE:[/b] If you changed where you directories are for locally installed Python packages, these lines will differ.

====Tickets Resolved & Prep-Work Done?====
Lets take a quick break and test what we have done thus far. The easiest way is to logout and back into your shell OR if you don't feel like doing that, you can source the two files we edited so that they become in-effect:
%%(bash)
source ~/.bash_profile
source ~/.bashrc
%%

Now you should be able to execute "python" and see something similar:
%%(bash)
username@host [~]# python
Python 2.6.2 (r262:71600, Aug 5 2009, 13:32:15)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
%%
Verify your Python version and type Ctrl-D to exit the Python interpreter.

**WARNING: From now on, I am going to be displaying code that uses Python 2.6, so just be aware and change the Python version when changing directories**.

====Installing Django====
There are two typical ways of installing Django: Release or latest development version. Which to choose? I have always used the development version and have never had any problems. You could also download the latest release tarball too. If you do decide to use the tarball release, just keep in mind some of these steps are irrelevant and/or different.

Now Tiny accounts are only limited to 75Mb of space and performing a regular [[http://subversion.tigris.org/ Subversion]] checkout takes just over 74Mb of space. Unacceptable. Seems like we are hosed, right? Luckily, we can //export// just the folder and set of files we need to get Django up and running. The rest of the checkout has a lot of bloat for keeping all the revision history, documentation, etc that is entirely unnecessary and can be found online where you can [[http://code.djangoproject.com/browser/django/trunk browse the source]]. This leaves the Django code at approximately 19Mb; definitely beats ~74Mb :D.

Ready? Great! So now lets install django into that site-packages directory we created earlier:
%%(bash)
cd ~/local/lib/python2.6/site-packages/
svn export http://code.djangoproject.com/svn/django/trunk/django django


# to update your Django code once in the site-packages directory
svn export --force http://code.djangoproject.com/svn/django/trunk/django django
%%
This will export the core django code into the "site-package" directory.

To test that you can use Django properly you should execute and see the following:
%%(bash)
username@host [~/]# django-admin.py
Type 'django-admin.py help' for usage.

username@host [~/]# python
Python 2.6.2 (r262:71600, Aug 5 2009, 13:32:15)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>>
%%
This is good, close out of the interpreter and Django is installed.

However, if something goes wrong:
%%(bash)
username@host [~/]# django-admin.py
-jailshell: django-admin.py: command not found

# or

>>> import django
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named django
>>>
%%
Check in //.bash_profile// that your PATH includes the where the django/bin directory is and that your PYTHONPATH includes the directory in which the //./django// directory is located. If your //.bash_profile// appears correct, check the actual environment:
%%(bash)
echo $PATH
echo $PYTHONPATH
%%
If the paths don't appear on any of the echo outputs, make sure that you source'd the bash profile file or just logout and log back into your shell.

====Create a Django Project====
Now, I won't go through all the steps of starting off your Django project, but I will do the bare minimum to get the basics up and running. Now I prefer to have a directory that holds my Django project, media folder, scripts, and templates:
%%(bash)
cd ~/
mkdir website
cd website
# replace 'myproj' with whatever your project name
django-admin.py startproject myproj

# this is up to you, but it is nice to keep everything contained
mkdir media
mkdir scripts
mkdir templates

# we now have
# ~/website
# ./media
# ./mpyroj
# ./scripts
# ./templates
%%

The last things that needs to get done is create a symlink to your project in the //./site-packages// directory so Python know where to find your project. **Remember:** we added the //./site-packages// to our PYTHONPATH so Python knows where to find everything; nice!
%%(bash)
cd ~/local/lib/python2.6/site-packages
ln -s ~/website/myproj
%%

Quick check that we can import our project in Python:
%%(python)
python
Python 2.6.2 (r262:71600, Aug 5 2009, 13:32:15)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import myproj
>>>
%%
No import errors? Great, lets move on!

====Install Flup====
Recall the link referencing how Django is preferred to be installed in the beginning? Well, using FCGI the "Django way" requires Flup to be installed. It may be a good idea to check the [[http://trac.saddi.com/flup Flup website]] to see what the latest release is.
%%(bash)
cd ~/
wget http://www.saddi.com/software/flup/dist/flup-1.0.2.tar.gz
tar xzvf flup-1.0.2.tar.gz
cd flup-1.0.2
cp -r flup ~/local/lib/python2.6/site-packages/
%%

Quick check that we can import flup in Python:
%%(python)
python
Python 2.6.2 (r262:71600, Aug 5 2009, 13:32:15)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import flup
>>>
%%
No import errors? Great, lets move on!

====FCGI on Shared Hosting====
We are almost at the end of our journey. First we need to create a simple FCGI program in our //~/public_html// that will be executed that will dispatch web requests to your Django site. First create/open a file in your favorite editor "dispatch.fcgi" in your //~/public_html// directory:
%%(python)
#!/usr/local/bin/python2.6

import sys
import os

sys.path.append('/home/username/local/lib/python2.6/site-packages')

os.environ['DJANGO_SETTINGS_MODULE'] = 'myproj.settings'

from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")
%%
A few things to note. Replace the first line to where your python2.X is installed. You can check by executing `which python2.X` in case you aren't sure. Change the "username" to your login name. Finally, change "myproj.settings" to your "yourprojname.settings".

Also we need to make sure that this file is executable so that it can be run by Apache:
%%(bash)
chmod 755 dispatch.fcgi
%%

We can test the script by running:
%%(bash)
./dispatch.fcgi
%%
You should see HTML output the console! If so, we are in good shape.

If something goes wrong, make sure that FCGI is working by looking at the [[http://wiki.asmallorange.com/HOWTODjangoFastCGI Testing FastCGI]] on this ASO wiki page for making sure FCGI is working on your shared hosting.

====Modify .htaccess====
In your //~/public_html// directory, we just need to modify the //.htaccess// file so that web requests are dispatched to your dispatch.fcgi script.

Open up //~/public_html/.htaccess// and the entire file should be:
%%(htaccess)
AddHandler fastcgi-script .fcgi
RewriteEngine On # rewrite url request enabled
RewriteCond %{REQUEST_FILENAME} !-f # if the FILENAME requested isn't an actual file, perform the next command
RewriteRule ^(.*)$ dispatch.fcgi/$1 [QSA,L] # send requested urn to the dispatch.fcgi to be processed
%%

====Test your new Website====
Go to http://www.yourwebsite.com!

Hopefully you should see the Django welcome page because you haven't created anything yet on your site. Enjoy!

When you make changes to your code and would like to see them on your site, just update the timestamp of your //dispatch.fcgi// file and Apache will restart your Django application for you.
%%(bash)
touch mysite.fcgi
%%

====Admin Media====

If you run into trouble with media not showing up in the admin side of your app (no css, images, etc), you may need to link to them from your site's document root:
1) cd to your document root (i.e. //~/public_html//)
1) add a symlink to the django admin media:
%%(bash)
$ ln -s /home/username/local/lib/python2.x/site-packages/django/contrib/admin/media media
%%

More info from the official Django documentation here:
- [[http://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/#serving-admin-media-files]]
- [[http://docs.djangoproject.com/en/dev/howto/deployment/modpython/#id3]]

====Conclusion====
I hope this guide is helpful and that the ASO community may benefit from this wealth of information.

====Notes====
To make sure no one else on your shard hosting server can view your password in your project's [i]./settings.py[/i] file, we should change the permissions so only you can view and edit this file:
%%(bash)
chmod 600 ~/website/myproj/settings.py
%%




Revision [1601]

Edited on 2009-09-23 08:54:07 by EricVW
Additions:
=====Using Django on ASO with FastCGI=====

====Introduction====
After much looking around at various resources and my experience on getting Django FCGI working, I thought I would post an up-to-date guide on getting Django working with ASO. Hopefully this guide will be a benefit for the ASO community.

This guide will be aimed towards Tiny account holders, but to anyone else who has more storage to play with, they can tweak some of the steps to their liking.

This guides differs in such that the setup is as close to the recommended setup on Django's deployment page for [[http://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/#running-django-on-a-shared-hosting-provider-with-apache Running Django on a shared-hosting provider with Apache]].

====Assumptions====
This guide assumes that the reader is familiar with Linux and its basic commands, a terminal, SSH, and have basic programming knowledge, preferably (hopefully) in Python. If you are confused at this point about what I am talking about, then it may be a good idea to read up on what all of this is so that you don't feel like a deer in the headlights as you proceed. Additionally, knowing a decent text editor (emacs, vim, nano, etc) is a must.

I won't go through a super detailed tutorial on some of these "basic" things such as logging into your account through SSH, changing to every single directory, and anything similar. If something is severely left out or makes the guide a complete loss, please edit where necessary.

====Requirements====
To perform anything that will be shown in the rest of this guide you **must** have shell/ssh access on your account. This can be done by submitting a ticket.

Django is not really picky on what version Python you are using since the core components require anything between 2.3-2.6. However, any modules from the django.contrib package may require more recent versions of Python. I would **highly** recommend either //Python2.5// or //Python2.6// since that is better supported overall by Django and any other contributing modules. You may request a particular version to be installed by submitting a ticket. You **should not** request Python3.x installed since Django does not support this version due to backwards compatibility support from Python. More information can be found at the Django [[http://docs.djangoproject.com/en/dev/faq/install/#faq-install install faq]] for the curious.

If you plan on using MySQL as your database back-end, you might as well submit a ticket for the MySQLdb module for the version of Python that you have installed or requested.

====Preparation====
While you are waiting for your ticket(s) to be resolved or if they are done already, we can take care of these next steps that don't require the packages being installed. If you don't have shell/ssh access, then I guess just sit tight.

First, we will create a directory where we will store Python packages/modules that we will be installing or symlink'ing to. You may set up your directories wherever you like, just make sure to keep that in mind through the rest of the guide when setting up environment variables and when I refer to this directory. I prefer to create a directory structure similar to "/usr/local" in my home directory:
%%
mkdir -p ~/local/lib/python2.X/site-packages
%%
Replace "X" with your Python version that is (will be installed).

To set up your shell/ssh environment, we will edit your //.bashrc// and //.bash_profile//. The aliases and environment variables set in these files will make working with your Python and Django installs through the SSH simpler. First, open up //.bashrc// and add the following line:
%%(bash)
alias python=python2.X
%%
Replace "X" with your Python version that is (will be) installed. This will execute the correct Python version you wish to use whenever you run "python" on the command line for the interpreter or when running scripts.

Now open //.bash_profile// to set up two environment variables so that commands become available on the command line once Django is installed and to add to the path where Python looks for installed packages/modules. Please add the following two lines:
%%(bash)
export PATH=$PATH:$HOME/local/lib/python2.X/site-packages/django/bin
export PYTHONPATH=$PYTHONPATH:$HOME/local/lib/python2.X/site-packages
%%
Replace "X" with your Python version that is (will be) installed. [b]NOTE:[/b] If you changed where you directories are for locally installed Python packages, these lines will differ.

====Tickets Resolved & Prep-Work Done?====
Lets take a quick break and test what we have done thus far. The easiest way is to logout and back into your shell OR if you don't feel like doing that, you can source the two files we edited so that they become in-effect:
%%(bash)
source ~/.bash_profile
source ~/.bashrc
%%

Now you should be able to execute "python" and see something similar:
%%(bash)
username@host [~]# python
Python 2.6.2 (r262:71600, Aug 5 2009, 13:32:15)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
%%
Verify your Python version and type Ctrl-D to exit the Python interpreter.

**WARNING: From now on, I am going to be displaying code that uses Python 2.6, so just be aware and change the Python version when changing directories**.

====Installing Django====
There are two typical ways of installing Django: Release or latest development version. Which to choose? I have always used the development version and have never had any problems. You could also download the latest release tarball too. If you do decide to use the tarball release, just keep in mind some of these steps are irrelevant and/or different.

Now Tiny accounts are only limited to 75Mb of space and performing a regular [[http://subversion.tigris.org/ Subversion]] checkout takes just over 74Mb of space. Unacceptable. Seems like we are hosed, right? Luckily, we can //export// just the folder and set of files we need to get Django up and running. The rest of the checkout has a lot of bloat for keeping all the revision history, documentation, etc that is entirely unnecessary and can be found online where you can [[http://code.djangoproject.com/browser/django/trunk browse the source]]. This leaves the Django code at approximately 19Mb; definitely beats ~74Mb :D.

Ready? Great! So now lets install django into that site-packages directory we created earlier:
%%(bash)
cd ~/local/lib/python2.6/site-packages/
svn export http://code.djangoproject.com/svn/django/trunk/django django


# to update your Django code once in the site-packages directory
svn export --force http://code.djangoproject.com/svn/django/trunk/django django
%%
This will export the core django code into the "site-package" directory.

To test that you can use Django properly you should execute and see the following:
%%(bash)
username@host [~/]# django-admin.py
Type 'django-admin.py help' for usage.

username@host [~/]# python
Python 2.6.2 (r262:71600, Aug 5 2009, 13:32:15)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>>
%%
This is good, close out of the interpreter and Django is installed.

However, if something goes wrong:
%%(bash)
username@host [~/]# django-admin.py
-jailshell: django-admin.py: command not found

# or

>>> import django
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named django
>>>
%%
Check in //.bash_profile// that your PATH includes the where the django/bin directory is and that your PYTHONPATH includes the directory in which the //./django// directory is located. If your //.bash_profile// appears correct, check the actual environment:
%%(bash)
echo $PATH
echo $PYTHONPATH
%%
If the paths don't appear on any of the echo outputs, make sure that you source'd the bash profile file or just logout and log back into your shell.

====Create a Django Project====
Now, I won't go through all the steps of starting off your Django project, but I will do the bare minimum to get the basics up and running. Now I prefer to have a directory that holds my Django project, media folder, scripts, and templates:
%%(bash)
cd ~/
mkdir website
cd website
# replace 'myproj' with whatever your project name
django-admin.py startproject myproj

# this is up to you, but it is nice to keep everything contained
mkdir media
mkdir scripts
mkdir templates

# we now have
# ~/website
# ./media
# ./mpyroj
# ./scripts
# ./templates
%%

The last things that needs to get done is create a symlink to your project in the //./site-packages// directory so Python know where to find your project. **Remember:** we added the //./site-packages// to our PYTHONPATH so Python knows where to find everything; nice!
%%(bash)
cd ~/local/lib/python2.6/site-packages
ln -s ~/website/myproj
%%

Quick check that we can import our project in Python:
%%(python)
python
Python 2.6.2 (r262:71600, Aug 5 2009, 13:32:15)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import myproj
>>>
%%
No import errors? Great, lets move on!

====Install Flup====
Recall the link referencing how Django is preferred to be installed in the beginning? Well, using FCGI the "Django way" requires Flup to be installed. It may be a good idea to check the [[http://trac.saddi.com/flup Flup website]] to see what the latest release is.
%%(bash)
cd ~/
wget http://www.saddi.com/software/flup/dist/flup-1.0.2.tar.gz
tar xzvf flup-1.0.2.tar.gz
cd flup-1.0.2
cp -r flup ~/local/lib/python2.6/site-packages/
%%

Quick check that we can import flup in Python:
%%(python)
python
Python 2.6.2 (r262:71600, Aug 5 2009, 13:32:15)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import flup
>>>
%%
No import errors? Great, lets move on!

====FCGI on Shared Hosting====
We are almost at the end of our journey. First we need to create a simple FCGI program in our //~/public_html// that will be executed that will dispatch web requests to your Django site. First create/open a file in your favorite editor "dispatch.fcgi" in your //~/public_html// directory:
%%(python)
#!/usr/local/bin/python2.6

import sys
import os

sys.path.append('/home/username/local/lib/python2.6/site-packages')

os.environ['DJANGO_SETTINGS_MODULE'] = 'myproj.settings'

from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")
%%
A few things to note. Replace the first line to where your python2.X is installed. You can check by executing `which python2.X` in case you aren't sure. Change the "username" to your login name. Finally, change "myproj.settings" to your "yourprojname.settings".

Also we need to make sure that this file is executable so that it can be run by Apache:
%%(bash)
chmod 755 dispatch.fcgi
%%

We can test the script by running:
%%(bash)
./dispatch.fcgi
%%
You should see HTML output the console! If so, we are in good shape.

If something goes wrong, make sure that FCGI is working by looking at the [[http://wiki.asmallorange.com/HOWTODjangoFastCGI Testing FastCGI]] on this ASO wiki page for making sure FCGI is working on your shared hosting.

====Modify .htaccess====
In your //~/public_html// directory, we just need to modify the //.htaccess// file so that web requests are dispatched to your dispatch.fcgi script.

Open up //~/public_html/.htaccess// and the entire file should be:
%%(htaccess)
AddHandler fastcgi-script .fcgi
RewriteEngine On # rewrite url request enabled
RewriteCond %{REQUEST_FILENAME} !-f # if the FILENAME requested isn't an actual file, perform the next command
RewriteRule ^(.*)$ dispatch.fcgi/$1 [QSA,L] # send requested urn to the dispatch.fcgi to be processed
%%

====Test your new Website====
Go to http://www.yourwebsite.com!

Hopefully you should see the Django welcome page because you haven't created anything yet on your site. Enjoy!

When you make changes to your code and would like to see them on your site, just update the timestamp of your //dispatch.fcgi// file and Apache will restart your Django application for you.
%%(bash)
touch mysite.fcgi
%%

====Admin Media====

If you run into trouble with media not showing up in the admin side of your app (no css, images, etc), you may need to link to them from your site's document root:
1) cd to your document root (i.e. //~/public_html//)
1) add a symlink to the django admin media:
%%(bash)
$ ln -s /home/username/local/lib/python2.x/site-packages/django/contrib/admin/media media
%%

More info from the official Django documentation here:
- [[http://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/#serving-admin-media-files]]
- [[http://docs.djangoproject.com/en/dev/howto/deployment/modpython/#id3]]

====Conclusion====
I hope this guide is helpful and that the ASO community may benefit from this wealth of information.

====Notes====
To make sure no one else on your shard hosting server can view your password in your project's [i]./settings.py[/i] file, we should change the permissions so only you can view and edit this file:
%%(bash)
chmod 600 ~/website/myproj/settings.py
%%


Deletions:
=====Using Django on ASO with FastCGI=====
I've managed to get django working on my tiny account, mostly following [[http://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/ this]] document.
====Installing django====
We are going to work in /tmp to workaround some resitrictions with disk quotas.
%%
$ mkdir /tmp/$USER
$ cd /tmp/$USER
$ wget http://media.djangoproject.com/releases/1.0/Django-1.0.tar.gz && tar xzf Django-1.0.tar.gz
$ wget http://www.saddi.com/software/flup/dist/flup-1.0.1.tar.gz && tar xzf flup-1.0.1.tar.gz
$ cd Django-1.0
$ python setup.py install --prefix $HOME/local/django-1.0
$ cd ..
$ cd flup-1.0.1
$ mkdir -p $HOME/local/flup-1.0.1/lib/python2.4/site-packages
$ cp -r flup $HOME/local/flup-1.0.1/lib/python2.4/site-packages
%%
We can now remove temporary files
%%
$ cd $HOME
$ rm -ri /tmp/$USER
%%
====Setting up paths====
Now we have to tell python where to get the packages we have just installed. To do so, we create the "~/.pythonrc.py" script:
%%
import sys
home = '/home/'
sys.path += (home+'/local/django-1.0/lib/python2.4/site-packages',
home+'/local/flup-1.0.1/lib/python2.4/site-packages',
home+'/django-projects')
%%
Now start the python interpreter and try the following:
%%
>>> import django
Traceback (most recent call last):
File "", line 1, in ?
ImportError: No module named django
>>> import flup
Traceback (most recent call last):
File "", line 1, in ?
ImportError: No module named flup
>>> import user #this executes the ~/.pythonrc.py file
>>> import django
>>> import flup
%%
====Setup django dispatcher====
We can now try to set up our first django site. After having uploaded a project into "~/django-projects" (i.e.: "~/django-projects/myproject") we need to create the script that will handle requests to django. Create a new file named "~/public_html/myproject.fcgi" and put the following content in it:
%%
#!/usr/bin/env python
import os, user
# Switch to the directory of your project. (Optional.)
# os.chdir("/home/__MYUSER__/django-projects/myproject")
# Set the DJANGO_SETTINGS_MODULE environment variable.
os.environ['DJANGO_SETTINGS_MODULE'] = "myproject.settings"
from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")
%%
Give it the right permissions and execute it
%%
$ chmod 755 ~/public_html/myproject.fcgi
$ ~/public_html/myproject.fcgi
%%
If all goes right you should already be able to reach this installation at http://mydomain/myproject.fcgi/
But you probably want good-looking urls so add the following content to your "~/public_html/.htaccess" file:
%%
AddHandler fastcgi-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ myproject.fcgi/$1 [QSA,L]
%%
And if you cam reach django at http://mydomain/ you're done!
====Testing FastCGI====
If for some reason your django installation does not work, you can try to debug if FastCGI alone is working. Create a "~/public_html/hello.fcgi" file with the following content
%%
#!/usr/bin/env python
import user
from flup.server.fcgi import WSGIServer
def test_app(environ, start_response):
start_response('200 OK', [('Content-Type', 'text/plain')])
yield 'Hello, world!\n'
WSGIServer(test_app).run()
%%
Make it executable and run it from the commandline:
%%
$ chmod 755 ~/public_html/hello.fcgi
$ ~/public_html/hello.fcgi
%%
and you should see some output with "Hello, World!" in it. You can now point your browser to http://mydomain/hello.fcgi and you should see "Hello, world!"
====Admin Media====
If you run into trouble with media not showing up in the admin side of your app (no css, images, etc), you may need to link to them from your site's document root:
1) cd to your document root (i.e. //public_html//)
1) add a symlink to the django admin media:
%%
$ ln -s /home/username/local/lib/python2.x/site-packages/django/contrib/admin/media media
%%
More info from the official Django documentation here:
- [[http://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/#serving-admin-media-files]]
- [[http://docs.djangoproject.com/en/dev/howto/deployment/modpython/#id3]]
====Final words====
I've choosed to use a separate directory for each package to ease upgrade of the single packages.
%%
rm -ri $HOME/local/django-1.0
tar xzf Django-x.y.z.tar.gz
cd Django-x.y.z
python setup.py install --prefix $HOME/local/django-x.y.z
# remember to edit "~/.pythonrc.py" accordingly
%%
With a tiny account as the one I have you probably want to use a media site that points to another location, but this is out of the scope of this article.
Have fun with django!


Revision [1575]

Edited on 2009-08-30 20:47:36 by BrianKrygsman [Added section on linking to admin media]
Additions:
home+'/local/flup-1.0.1/lib/python2.4/site-packages',
home+'/django-projects')
====Admin Media====
If you run into trouble with media not showing up in the admin side of your app (no css, images, etc), you may need to link to them from your site's document root:
1) cd to your document root (i.e. //public_html//)
1) add a symlink to the django admin media:
$ ln -s /home/username/local/lib/python2.x/site-packages/django/contrib/admin/media media
More info from the official Django documentation here:
- [[http://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/#serving-admin-media-files]]
- [[http://docs.djangoproject.com/en/dev/howto/deployment/modpython/#id3]]
Deletions:
home+'/local/flup-1.0.1/lib/python2.4/site-packages',
home+'/django-projects')


Revision [1245]

Edited on 2008-09-16 11:59:53 by AlessandroGuido [general better wording and a more elegant way to set packages paths]
Additions:
I've managed to get django working on my tiny account, mostly following [[http://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/ this]] document.
Now we have to tell python where to get the packages we have just installed. To do so, we create the "~/.pythonrc.py" script:
home = '/home/'
sys.path += (home+'/local/django-1.0/lib/python2.4/site-packages',
home+'/local/flup-1.0.1/lib/python2.4/site-packages',
home+'/django-projects')
Now start the python interpreter and try the following:
Traceback (most recent call last):
File "", line 1, in ?
ImportError: No module named django
Traceback (most recent call last):
File "", line 1, in ?
ImportError: No module named flup
>>> import user #this executes the ~/.pythonrc.py file
We can now try to set up our first django site. After having uploaded a project into "~/django-projects" (i.e.: "~/django-projects/myproject") we need to create the script that will handle requests to django. Create a new file named "~/public_html/myproject.fcgi" and put the following content in it:
import os, user
Give it the right permissions and execute it
If all goes right you should already be able to reach this installation at http://mydomain/myproject.fcgi/
But you probably want good-looking urls so add the following content to your "~/public_html/.htaccess" file:
AddHandler fastcgi-script .fcgi
And if you cam reach django at http://mydomain/ you're done!
If for some reason your django installation does not work, you can try to debug if FastCGI alone is working. Create a "~/public_html/hello.fcgi" file with the following content
import user
and you should see some output with "Hello, World!" in it. You can now point your browser to http://mydomain/hello.fcgi and you should see "Hello, world!"
I've choosed to use a separate directory for each package to ease upgrade of the single packages.
# remember to edit "~/.pythonrc.py" accordingly
Deletions:
I've managed to get django working on my tiny account, mostly following [[http://www.djangoproject.com/documentation/fastcgi/ this]] document.
Probably you want to be able to use the django-admin.py script and so on. To do it you need to setup some environmental variables: edit your ~/.bash_profile and make sure to add something like this
export PYTHONPATH="$PYTHONPATH:$HOME/local/django-1.0/lib/python2.4/site-packages"
export PYTHONPATH="$PYTHONPATH:$HOME/local/flup-1.0.1/lib/python2.4/site-packages"
export PATH="$PATH:$HOME/local/django-1.0/bin"
Logout, login again and open the python interpreter: you should be able to do just fine
To test if flup is working create ~/public_html/hello.fcgi with the following content:
# httpd process doesn't have the PYTHONPATH env var
sys.path += ('/home/__MYUSER__/local/flup-1.0.1/lib/python2.4/site-packages', )
$ unset PYTHONPATH
and you should see "Hello, World!" in the output. Then try to reach it with your browser.
If fastcgi is working, then we can continue and set up our django project:
$ mkdir django-projects
$ cd django-projects
$ django-admin.py startproject myproject
$ cd myproject
... edit settings.py ...
$ python manage.py syncdb
A dispatcher is needed to get django working. Create a new file ~/public_html/myproject.fcgi
import sys, os
# httpd process doesn't have the PYTHONPATH env var set
sys.path += ('/home/__MYUSER__/local/django-1.0/lib/python2.4/site-packages',
'/home/__MYUSER__/local/flup-1.0.1/lib/python2.4/site-packages',
'/home/__MYUSER__/django-projects')
give it right permissions and test
$ unset PYTHONPATH
You should now be able to reach it through yout broser at http://mydomain/myproject.fcgi
====URL rewriting rules====
The next thing to do is to setup rewrite rules to get better urls
edit your ~/public_html/.htaccess (this will work if you have only one project)
I've choosed to use a separate directory for each package to ease upgrade. E.g. when django-x.y.z comes out you can simply do:


Revision [1243]

Edited on 2008-09-09 16:25:29 by AlessandroGuido [document how to upgrade django without repeating the whole process]
Additions:
I've choosed to use a separate directory for each package to ease upgrade. E.g. when django-x.y.z comes out you can simply do:
rm -ri $HOME/local/django-1.0
tar xzf Django-x.y.z.tar.gz
cd Django-x.y.z
python setup.py install --prefix $HOME/local/django-x.y.z


Revision [1242]

Edited on 2008-09-09 16:19:06 by AlessandroGuido [extend sys.path in a single instruction as a small optimization]
Additions:
sys.path += ('/home/__MYUSER__/local/flup-1.0.1/lib/python2.4/site-packages', )
sys.path += ('/home/__MYUSER__/local/django-1.0/lib/python2.4/site-packages',
'/home/__MYUSER__/local/flup-1.0.1/lib/python2.4/site-packages',
'/home/__MYUSER__/django-projects')
Deletions:
sys.path += ['/home/__MYUSER__/local/flup-1.0.1/lib/python2.4/site-packages']
sys.path += ['/home/__MYUSER__/local/django-1.0/lib/python2.4/site-packages']
sys.path += ['/home/__MYUSER__/local/flup-1.0.1/lib/python2.4/site-packages']
sys.path += ['/home/__MYUSER__/django-projects']


Revision [1241]

Edited on 2008-09-09 16:14:17 by AlessandroGuido
Additions:
We are going to work in /tmp to workaround some resitrictions with disk quotas.
$ wget http://media.djangoproject.com/releases/1.0/Django-1.0.tar.gz && tar xzf Django-1.0.tar.gz
$ wget http://www.saddi.com/software/flup/dist/flup-1.0.1.tar.gz && tar xzf flup-1.0.1.tar.gz
$ cd Django-1.0
$ python setup.py install --prefix $HOME/local/django-1.0
$ cd ..
$ cd flup-1.0.1
$ mkdir -p $HOME/local/flup-1.0.1/lib/python2.4/site-packages
$ cp -r flup $HOME/local/flup-1.0.1/lib/python2.4/site-packages
====Setting up paths====
Probably you want to be able to use the django-admin.py script and so on. To do it you need to setup some environmental variables: edit your ~/.bash_profile and make sure to add something like this
export PYTHONPATH="$PYTHONPATH:$HOME/local/django-1.0/lib/python2.4/site-packages"
export PYTHONPATH="$PYTHONPATH:$HOME/local/flup-1.0.1/lib/python2.4/site-packages"
export PATH="$PATH:$HOME/local/django-1.0/bin"
Logout, login again and open the python interpreter: you should be able to do just fine
>>> import django
>>> import flup
To test if flup is working create ~/public_html/hello.fcgi with the following content:
#!/usr/bin/env python
# httpd process doesn't have the PYTHONPATH env var
sys.path += ['/home/__MYUSER__/local/flup-1.0.1/lib/python2.4/site-packages']
$ unset PYTHONPATH
If fastcgi is working, then we can continue and set up our django project:
#!/usr/bin/env python
# httpd process doesn't have the PYTHONPATH env var set
sys.path += ['/home/__MYUSER__/local/django-1.0/lib/python2.4/site-packages']
sys.path += ['/home/__MYUSER__/local/flup-1.0.1/lib/python2.4/site-packages']
$ unset PYTHONPATH
====Final words====
With a tiny account as the one I have you probably want to use a media site that points to another location, but this is out of the scope of this article.
Have fun with django!
Deletions:
Firstly we download the latest django code from its svn and install in our home directory
$ svn co http://code.djangoproject.com/svn/django/trunk/ django-trunk
$ cd django-trunk
$ python setup.py install --prefix $HOME/local
Then we need to set up some environment variables: add theese two lines at the bottom of $HOME/.bash_profile with your favourite editor
export PYTHONPATH="$PYTHONPATH:$HOME/local/lib/python2.4/site-packages"
export PATH="$PATH:$HOME/local/bin"
and then check
$ source $HOME/.bash_profile
$ echo $PYTHONPATH
Then we need an additional package called "flup" to get fastcgi working
$ wget http://www.saddi.com/software/flup/dist/flup-1.0.tar.gz
$ tar xzf flup-1.0.tar.gz
$ cd flup-1.0
$ cp -r flup $HOME/local/lib/python2.4/site-packages
To test if flup is working create ~/public_html/hello.fcgi with the following content
#!/bin/env python
sys.path += ['/home/__MYUSER__/local/lib/python2.4/site-packages']
If fastcgi is working, then we can procede with setting up our django project:
#!/bin/env python
sys.path += ['/home/__MYUSER__/local/lib/python2.4/site-packages']
If you have more projects try the following (untested)
RewriteRule ^myproject/(.*)$ myproject.fcgi/$1 [QSA,L]
RewriteRule ^otherproject/(.*)$ otherproject.fcgi/$1 [QSA,L]
And you should be able to reach your sites with http://mydomain/myproject/ and http://mydomain/otherprojects/
Obviously you have to create the otherproject.fcgi dispatcher
====Admin media====
To get a working admin site I did the following:
Edit myproject/settings.py
ADMIN_MEDIA = '/admin_media/'
and
$ cd ~/public_html
$ ln -s ../local/lib/python2.4/site-packages/django/contrib/admin/media admin_media
However, for a tiny account, you should try to get media files from another host


Revision [1166]

Edited on 2008-06-19 14:51:30 by AlessandroGuido

No differences.

Revision [1165]

Edited on 2008-06-19 14:50:25 by AlessandroGuido
Additions:
=====Using Django on ASO with FastCGI=====
====Installing django====
====Testing FastCGI====
====Setup django dispatcher====
====URL rewriting rules====
====Admin media====
Deletions:
=====Installing django=====
=====Testing FastCGI=====
=====Setup django dispatcher=====
=====URL rewriting rules=====
=====Admin media=====


Revision [1164]

Edited on 2008-06-19 14:49:25 by AlessandroGuido
Additions:
=====Installing django=====
=====Testing FastCGI=====
=====Setup django dispatcher=====
=====URL rewriting rules=====


Revision [1163]

Edited on 2008-06-19 06:55:41 by AlessandroGuido
Additions:
=====Admin media=====
To get a working admin site I did the following:
Edit myproject/settings.py
ADMIN_MEDIA = '/admin_media/'
and
$ cd ~/public_html
$ ln -s ../local/lib/python2.4/site-packages/django/contrib/admin/media admin_media
However, for a tiny account, you should try to get media files from another host
Deletions:
That's all folks! Enjoy your django ;)


Revision [1162]

Edited on 2008-06-19 06:38:23 by AlessandroGuido
Additions:
I've managed to get django working on my tiny account, mostly following [[http://www.djangoproject.com/documentation/fastcgi/ this]] document.
Firstly we download the latest django code from its svn and install in our home directory
$ mkdir /tmp/$USER
$ cd /tmp/$USER
$ svn co http://code.djangoproject.com/svn/django/trunk/ django-trunk
$ cd django-trunk
$ python setup.py install --prefix $HOME/local
Then we need to set up some environment variables: add theese two lines at the bottom of $HOME/.bash_profile with your favourite editor
export PYTHONPATH="$PYTHONPATH:$HOME/local/lib/python2.4/site-packages"
export PATH="$PATH:$HOME/local/bin"
and then check
$ source $HOME/.bash_profile
$ echo $PYTHONPATH
Then we need an additional package called "flup" to get fastcgi working
$ cd /tmp/$USER
$ wget http://www.saddi.com/software/flup/dist/flup-1.0.tar.gz
$ tar xzf flup-1.0.tar.gz
$ cd flup-1.0
$ cp -r flup $HOME/local/lib/python2.4/site-packages
We can now remove temporary files
$ cd $HOME
$ rm -ri /tmp/$USER
To test if flup is working create ~/public_html/hello.fcgi with the following content
#!/bin/env python
sys.path += ['/home/__MYUSER__/local/lib/python2.4/site-packages']
from flup.server.fcgi import WSGIServer
def test_app(environ, start_response):
start_response('200 OK', [('Content-Type', 'text/plain')])
yield 'Hello, world!\n'
WSGIServer(test_app).run()
Make it executable and run it from the commandline:
$ chmod 755 ~/public_html/hello.fcgi
$ ~/public_html/hello.fcgi
and you should see "Hello, World!" in the output. Then try to reach it with your browser.
If fastcgi is working, then we can procede with setting up our django project:
$ cd $HOME
$ mkdir django-projects
$ cd django-projects
$ django-admin.py startproject myproject
$ cd myproject
... edit settings.py ...
$ python manage.py syncdb
A dispatcher is needed to get django working. Create a new file ~/public_html/myproject.fcgi
#!/bin/env python
import sys, os
sys.path += ['/home/__MYUSER__/local/lib/python2.4/site-packages']
sys.path += ['/home/__MYUSER__/django-projects']
# Switch to the directory of your project. (Optional.)
# os.chdir("/home/__MYUSER__/django-projects/myproject")
# Set the DJANGO_SETTINGS_MODULE environment variable.
os.environ['DJANGO_SETTINGS_MODULE'] = "myproject.settings"
from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")
give it right permissions and test
$ chmod 755 ~/public_html/myproject.fcgi
$ ~/public_html/myproject.fcgi
You should now be able to reach it through yout broser at http://mydomain/myproject.fcgi
The next thing to do is to setup rewrite rules to get better urls
edit your ~/public_html/.htaccess (this will work if you have only one project)
RewriteEngine On
RewriteRule ^(.*)$ myproject.fcgi/$1 [QSA,L]
If you have more projects try the following (untested)
RewriteEngine On
RewriteRule ^myproject/(.*)$ myproject.fcgi/$1 [QSA,L]
RewriteRule ^otherproject/(.*)$ otherproject.fcgi/$1 [QSA,L]
And you should be able to reach your sites with http://mydomain/myproject/ and http://mydomain/otherprojects/
Obviously you have to create the otherproject.fcgi dispatcher
That's all folks! Enjoy your django ;)
Deletions:
====Note: This information may be out of date. If you have experience with Django FastCGI support, please provide an update====
I almost have [[http://www.djangoproject.com/ Django]] working on my tiny shared account. Actually, I think it works right, but I don't have the rewrite rules correct and that's causing the problem. Anyway, I'll step you through what I have so far.
First of all, you need to make sure you have Python2.3 for FCGI (and I think Django) to work. For more details about getting fcgi working, see [[http://forums.asmallorange.com/index.php?showtopic=4918 this thread]]. You also need to have shell access. If you don't, submit a ticket to ASO support.
First, open your shell and confirm your version of Python (be sure to use a Capital V):
%%-jailshell-2.05b$ python -V
Python 2.3.4
If you have anything prior to 2.3.x you'll have to see about getting your server upgraded. (I'm told the new servers are at 2.3.x while the old are 2.2.x - if you just signed up for a new account, you should be good)
Ok, assuming your on one of the new servers, it's time to get started. Although Django is now offered both as a tarball and from svn, I chose to install from subversion as its easier to update to latest trunk etc. In your shell, make sure you're in your HOME dir and do:
cd ~
svn co http://code.djangoproject.com/svn/django/trunk/ django_src
Run the following commands: (so that Django is available from your shell)
export PATH=$PATH:$HOME/django_src/django/bin
export PYTHONPATH=$PYTHONPATH:$HOME/django_src:$HOME/django_projects
Then add them to your .bash_profile file. Save the file, upload it and then continue with these instructions.
Create a Django projects directory and create your first Django project.
mkdir django_projects
cd django_projects
django-admin.py startproject myproject
If you don't want other users on your shared host to have access to your DB settings, change the permissions on your myproject.settings file so that ONLY YOUR USER can read them.
chmod 600 myproject/settings.py
Edit the myproject.settings (myproject/settings.py) file to add your database connection parameters.
Initialize the database.
manage.py syncdb
Now its time to create the publicly available directory. Whether you set that up as a sub domain through CPanel or just create a sub-dir under ~/public_html (which you can always point to with a sub domain of the same name later) is your choice. For this exersize, we'll assume your just creating a sub-dir, which needs to have the [[http://svn.saddi.com/py-lib/trunk/fcgi.py fcgi.py]] script.
cd ~/www
mkdir myproject
cd myproject
wget http://svn.saddi.com/py-lib/trunk/fcgi.py
chmod 755 fcgi.py
Now you need to create a file named django.fcgi in the same dir, which should contain the following (replace 'username' with your username on lines 3 and 4 and 'myproject' with the name of your project if it differs from the example used above):
%%(python)
#!/usr/bin/env python
sys.path += ['/home/username/django_src']
sys.path += ['/home/username/django_projects']
from fcgi import WSGIServer
from django.core.handlers.wsgi import WSGIHandler
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'
WSGIServer(WSGIHandler()).run()
Set the correct permissions on django.fcgi. Also, you must ensure django.fcgi uses Unix line endings in order for FastCGI to work.
%%chmod 755 django.fcgi%%
At this point you should be able to go to http://yourdomain.com/myproject/django.fcgi/admin/ and http://yourdomain.com/myproject/django.fcgi/. (Note: It usually takes a while for FastCGI to get ready and actually work. So, just let it sit on your server and keep on trying to access is it--because, for most people, it won't load on the first try.)
If you wish to pass everything in //myproject// dir through fast-cgi add the following to your **.htaccess** file within ~/www/myproject
%%RewriteEngine On
RewriteRule ^(.*)$ django.fcgi/myproject/$1 [QSA,L]
If you use the native admin goodness in django, you'll want to create a symbolic link to the admin media files so that your CSS and whatnot works correctly. Here's how:
cd ~/www
ln -s ~/django_src/django/contrib/admin/media media


Revision [881]

Edited on 2007-09-27 23:57:37 by TimDorr
Additions:
====Note: This information may be out of date. If you have experience with Django FastCGI support, please provide an update====


Revision [859]

Edited on 2007-08-09 11:55:24 by ShadyTrees [Unix line endings on django.fcgi]
Additions:
Set the correct permissions on django.fcgi. Also, you must ensure django.fcgi uses Unix line endings in order for FastCGI to work.
Deletions:
Set the correct permissions on django.fcgi.


Revision [689]

Edited on 2007-07-07 23:36:05 by ScottNS (unregistered user) [Fixed modification to .htaccess so admin feature will work]
Additions:
RewriteRule ^(.*)$ django.fcgi/myproject/$1 [QSA,L]
Deletions:
RewriteRule ^(.*)$ django.fcgi/$1 [QSA,L]


Revision [639]

Edited on 2007-06-29 01:52:49 by NateRitter [added the symbolic link for admin media]
Additions:
If you use the native admin goodness in django, you'll want to create a symbolic link to the admin media files so that your CSS and whatnot works correctly. Here's how:
ln -s ~/django_src/django/contrib/admin/media media


Revision [637]

Edited on 2007-06-28 22:29:06 by NateRitter [changed first line of the django.fcgi file to be environment general]
Additions:
I almost have [[http://www.djangoproject.com/ Django]] working on my tiny shared account. Actually, I think it works right, but I don't have the rewrite rules correct and that's causing the problem. Anyway, I'll step you through what I have so far.
First of all, you need to make sure you have Python2.3 for FCGI (and I think Django) to work. For more details about getting fcgi working, see [[http://forums.asmallorange.com/index.php?showtopic=4918 this thread]]. You also need to have shell access. If you don't, submit a ticket to ASO support.
First, open your shell and confirm your version of Python (be sure to use a Capital V):
%%-jailshell-2.05b$ python -V
Python 2.3.4
%%
If you have anything prior to 2.3.x you'll have to see about getting your server upgraded. (I'm told the new servers are at 2.3.x while the old are 2.2.x - if you just signed up for a new account, you should be good)
Ok, assuming your on one of the new servers, it's time to get started. Although Django is now offered both as a tarball and from svn, I chose to install from subversion as its easier to update to latest trunk etc. In your shell, make sure you're in your HOME dir and do:
%%
cd ~
svn co http://code.djangoproject.com/svn/django/trunk/ django_src
%%
Run the following commands: (so that Django is available from your shell)
%%
export PATH=$PATH:$HOME/django_src/django/bin
export PYTHONPATH=$PYTHONPATH:$HOME/django_src:$HOME/django_projects
%%
Then add them to your .bash_profile file. Save the file, upload it and then continue with these instructions.
Create a Django projects directory and create your first Django project.
%%
mkdir django_projects
cd django_projects
django-admin.py startproject myproject
%%
If you don't want other users on your shared host to have access to your DB settings, change the permissions on your myproject.settings file so that ONLY YOUR USER can read them.
%%
chmod 600 myproject/settings.py
%%
Edit the myproject.settings (myproject/settings.py) file to add your database connection parameters.
Initialize the database.
%%
manage.py syncdb
%%
Now its time to create the publicly available directory. Whether you set that up as a sub domain through CPanel or just create a sub-dir under ~/public_html (which you can always point to with a sub domain of the same name later) is your choice. For this exersize, we'll assume your just creating a sub-dir, which needs to have the [[http://svn.saddi.com/py-lib/trunk/fcgi.py fcgi.py]] script.
%%
cd ~/www
mkdir myproject
cd myproject
wget http://svn.saddi.com/py-lib/trunk/fcgi.py
chmod 755 fcgi.py
%%
Now you need to create a file named django.fcgi in the same dir, which should contain the following (replace 'username' with your username on lines 3 and 4 and 'myproject' with the name of your project if it differs from the example used above):
%%(python)
#!/usr/bin/env python
import sys
sys.path += ['/home/username/django_src']
sys.path += ['/home/username/django_projects']
from fcgi import WSGIServer
from django.core.handlers.wsgi import WSGIHandler
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'
WSGIServer(WSGIHandler()).run()
%%
Set the correct permissions on django.fcgi.
%%chmod 755 django.fcgi%%
At this point you should be able to go to http://yourdomain.com/myproject/django.fcgi/admin/ and http://yourdomain.com/myproject/django.fcgi/. (Note: It usually takes a while for FastCGI to get ready and actually work. So, just let it sit on your server and keep on trying to access is it--because, for most people, it won't load on the first try.)
If you wish to pass everything in //myproject// dir through fast-cgi add the following to your **.htaccess** file within ~/www/myproject
%%RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ django.fcgi/$1 [QSA,L]
%%
Deletions:
I almost have [[http://www.djangoproject.com/ Django]] working on my tiny shared account. Actually, I think it works right, but I don't have the rewrite rules correct and that's causing the problem. Anyway, I'll step you through what I have so far.

First of all, you need to make sure you have Python2.3 for FCGI (and I think Django) to work. For more details about getting fcgi working, see [[http://forums.asmallorange.com/index.php?showtopic=4918 this thread]]. You also need to have shell access. If you don't, submit a ticket to ASO support.

First, open your shell and confirm your version of Python (be sure to use a Capital V):

%%-jailshell-2.05b$ python -V
Python 2.3.4
%%

If you have anything prior to 2.3.x you'll have to see about getting your server upgraded. (I'm told the new servers are at 2.3.x while the old are 2.2.x - if you just signed up for a new account, you should be good)

Ok, assuming your on one of the new servers, it's time to get started. Although Django is now offered both as a tarball and from svn, I chose to install from subversion as its easier to update to latest trunk etc. In your shell, make sure you're in your HOME dir and do:

%%
cd ~
svn co http://code.djangoproject.com/svn/django/trunk/ django_src
%%

Run the following commands: (so that Django is available from your shell)

%%
export PATH=$PATH:$HOME/django_src/django/bin
export PYTHONPATH=$PYTHONPATH:$HOME/django_src:$HOME/django_projects
%%

Then add them to your .bash_profile file. Save the file, upload it and then continue with these instructions.

Create a Django projects directory and create your first Django project.

%%
mkdir django_projects
cd django_projects
django-admin.py startproject myproject
%%

If you don't want other users on your shared host to have access to your DB settings, change the permissions on your myproject.settings file so that ONLY YOUR USER can read them.

%%
chmod 600 myproject/settings.py
%%

Edit the myproject.settings (myproject/settings.py) file to add your database connection parameters.

Initialize the database.

%%
manage.py syncdb
%%

Now its time to create the publicly available directory. Whether you set that up as a sub domain through CPanel or just create a sub-dir under ~/public_html (which you can always point to with a sub domain of the same name later) is your choice. For this exersize, we'll assume your just creating a sub-dir, which needs to have the [[http://svn.saddi.com/py-lib/trunk/fcgi.py fcgi.py]] script.

%%
cd ~/www
mkdir myproject
cd myproject
wget http://svn.saddi.com/py-lib/trunk/fcgi.py
chmod 755 fcgi.py
%%

Now you need to create a file named django.fcgi in the same dir, which should contain the following (replace 'username' with your username on lines 3 and 4 and 'myproject' with the name of your project if it differs from the example used above):

%%(python)
#!/usr/bin/python
import sys
sys.path += ['/home/username/django_src']
sys.path += ['/home/username/django_projects']
from fcgi import WSGIServer
from django.core.handlers.wsgi import WSGIHandler
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'
WSGIServer(WSGIHandler()).run()
%%

Set the correct permissions on django.fcgi.

%%chmod 755 django.fcgi%%

At this point you should be able to go to http://yourdomain.com/myproject/django.fcgi/admin/ and http://yourdomain.com/myproject/django.fcgi/. (Note: It usually takes a while for FastCGI to get ready and actually work. So, just let it sit on your server and keep on trying to access is it--because, for most people, it won't load on the first try.)

If you wish to pass everything in //myproject// dir through fast-cgi add the following to your **.htaccess** file within ~/www/myproject
%%RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ django.fcgi/$1 [QSA,L]
%%


Revision [331]

Edited on 2007-02-12 18:40:15 by CollinGrady
Additions:
I almost have [[http://www.djangoproject.com/ Django]] working on my tiny shared account. Actually, I think it works right, but I don't have the rewrite rules correct and that's causing the problem. Anyway, I'll step you through what I have so far.

First of all, you need to make sure you have Python2.3 for FCGI (and I think Django) to work. For more details about getting fcgi working, see [[http://forums.asmallorange.com/index.php?showtopic=4918 this thread]]. You also need to have shell access. If you don't, submit a ticket to ASO support.

First, open your shell and confirm your version of Python (be sure to use a Capital V):

%%-jailshell-2.05b$ python -V
Python 2.3.4
%%

If you have anything prior to 2.3.x you'll have to see about getting your server upgraded. (I'm told the new servers are at 2.3.x while the old are 2.2.x - if you just signed up for a new account, you should be good)

Ok, assuming your on one of the new servers, it's time to get started. Although Django is now offered both as a tarball and from svn, I chose to install from subversion as its easier to update to latest trunk etc. In your shell, make sure you're in your HOME dir and do:

%%
cd ~
svn co http://code.djangoproject.com/svn/django/trunk/ django_src
%%

Run the following commands: (so that Django is available from your shell)

%%
export PATH=$PATH:$HOME/django_src/django/bin
export PYTHONPATH=$PYTHONPATH:$HOME/django_src:$HOME/django_projects
%%

Then add them to your .bash_profile file. Save the file, upload it and then continue with these instructions.

Create a Django projects directory and create your first Django project.

%%
mkdir django_projects
cd django_projects
django-admin.py startproject myproject
%%

If you don't want other users on your shared host to have access to your DB settings, change the permissions on your myproject.settings file so that ONLY YOUR USER can read them.

%%
chmod 600 myproject/settings.py
%%

Edit the myproject.settings (myproject/settings.py) file to add your database connection parameters.

Initialize the database.

%%
manage.py syncdb
%%

Now its time to create the publicly available directory. Whether you set that up as a sub domain through CPanel or just create a sub-dir under ~/public_html (which you can always point to with a sub domain of the same name later) is your choice. For this exersize, we'll assume your just creating a sub-dir, which needs to have the [[http://svn.saddi.com/py-lib/trunk/fcgi.py fcgi.py]] script.

%%
cd ~/www
mkdir myproject
cd myproject
wget http://svn.saddi.com/py-lib/trunk/fcgi.py
chmod 755 fcgi.py
%%

Now you need to create a file named django.fcgi in the same dir, which should contain the following (replace 'username' with your username on lines 3 and 4 and 'myproject' with the name of your project if it differs from the example used above):

%%(python)
#!/usr/bin/python
import sys
sys.path += ['/home/username/django_src']
sys.path += ['/home/username/django_projects']
from fcgi import WSGIServer
from django.core.handlers.wsgi import WSGIHandler
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'
WSGIServer(WSGIHandler()).run()
%%

Set the correct permissions on django.fcgi.

%%chmod 755 django.fcgi%%

At this point you should be able to go to http://yourdomain.com/myproject/django.fcgi/admin/ and http://yourdomain.com/myproject/django.fcgi/. (Note: It usually takes a while for FastCGI to get ready and actually work. So, just let it sit on your server and keep on trying to access is it--because, for most people, it won't load on the first try.)

If you wish to pass everything in //myproject// dir through fast-cgi add the following to your **.htaccess** file within ~/www/myproject
%%RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ django.fcgi/$1 [QSA,L]
%%
Deletions:
I almost have [[http://www.djangoproject.com/ Django]] working on my tiny shared account. Actually, I think it works right, but I don't have the rewrite rules correct and that's causing the problem. Anyway, I'll step you through what I have so far.
First of all, you need to make sure you have Python2.3 for FCGI (and I think Django) to work. For more details about getting fcgi working, see [[http://forums.asmallorange.com/index.php?showtopic=4918 this thread]]. You also need to have shell access. If you don't, submit a ticket to ASO support.
First, open your shell and confirm your version of Python (be sure to use a Capital V):
%%-jailshell-2.05b$ python -V
Python 2.3.4
%%
If you have anything prior to 2.3.x you'll have to see about getting your server upgraded. (I'm told the new servers are at 2.3.x while the old are 2.2.x - if you just signed up for a new account, you should be good)
Ok, assuming your on one of the new servers, it's time to get started. Although Django is now offered both as a tarball and from svn, I chose to install from subversion as its easier to update to latest trunk etc. In your shell, make sure you're in your HOME dir and do:
%%
cd ~
svn co http://code.djangoproject.com/svn/django/trunk/ django_src
%%
Run the following commands: (so that Django is available from your shell)
%%
export PATH=$PATH:$HOME/django_src/django/bin
export PYTHONPATH=$PYTHONPATH:$HOME/django_src:$HOME/django_projects
%%
Then add them to your .bash_profile file. Save the file, upload it and then continue with these instructions.
Create a Django projects directory and create your first Django project.
%%
mkdir django_projects
cd django_projects
django-admin.py startproject myproject
%%
If you don't want other users on your shared host to have access to your DB settings, change the permissions on your myproject.settings file so that ONLY YOUR USER can read them.
%%
chmod 600 myproject/settings.py
%%
Edit the myproject.settings (myproject/settings.py) file to add your database connection parameters.
Initialize the database.
%%
django-admin.py init --settings=myproject.settings
%%
Create a superuser account for use with the admin interface (follow the prompts).
%%
django-admin.py createsuperuser --settings=myproject.settings
%%
Now its time to create the publicly available directory. Whether you set that up as a sub domain through CPanel or just create a sub-dir under ~/public_html (which you can always point to with a sub domain of the same name later) is your choice. For this exersize, we'll assume your just creating a sub-dir, which needs to have the [[http://svn.saddi.com/py-lib/trunk/fcgi.py fcgi.py]] script.
%%
cd ~/www
mkdir myproject
cd myproject
wget http://svn.saddi.com/py-lib/trunk/fcgi.py
chmod 755 fcgi.py
%%
Now you need to create a file named django.fcgi in the same dir, which should contain the following (replace 'username' with your username on lines 3 and 4 and 'myproject' with the name of your project if it differs from the example used above):
%%(python)
#!/usr/bin/python
import sys
sys.path += ['/home/username/django_src']
sys.path += ['/home/username/django_projects']
from fcgi import WSGIServer
from django.core.handlers.wsgi import WSGIHandler
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'
WSGIServer(WSGIHandler()).run()
%%
Set the correct permissions on django.fcgi.
%%chmod 755 django.fcgi%%
At this point you should be able to go to http://yourdomain.com/myproject/django.fcgi/admin/ and http://yourdomain.com/myproject/django.fcgi/. (Note: It usually takes a while for FastCGI to get ready and actually work. So, just let it sit on your server and keep on trying to access is it--because, for most people, it won't load on the first try.)
If you wish to pass everything in //myproject// dir through fast-cgi add the following to your **.htaccess** file within ~/www/myproject
%%RewriteEngine On
RewriteBase /myproject/
RewriteRule ^(media/.*)$ - [L]
RewriteCond %{REQUEST_URI} !(django.fcgi)
RewriteRule ^(.*)$ django.fcgi/$1 [L]
%%
I'm getting some python errors regarding the url which is most likely because there are no rewrite rules yet. However, when I try anything that makes sense, I get a 403 Forbidden error - which indicates a problem with the rewrite rules, not Django. I'm still working on it.


Revision [111]

Edited on 2006-04-15 20:24:41 by RaymondNunez
Additions:
At this point you should be able to go to http://yourdomain.com/myproject/django.fcgi/admin/ and http://yourdomain.com/myproject/django.fcgi/. (Note: It usually takes a while for FastCGI to get ready and actually work. So, just let it sit on your server and keep on trying to access is it--because, for most people, it won't load on the first try.)
Deletions:
At this point you should be able to go to http://yourdomain.com/myproject/django.fcgi/admin/ and http://yourdomain.com/myproject/django.fcgi/. (Note: It usually takes a while for FastCGI to get ready and actually work. SO, just le tit sit on your server and keep on trying to access is it-because, for most people, it won't load on the first try.)


Revision [110]

The oldest known version of this page was created on 2006-04-15 20:24:13 by RaymondNunez
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki