Django from git
git clone https://github.com/django/django.git ~/Applications/django
Where is the SITE-PACKAGES dir?
python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"
Let Python know where django is:
sudo ln -s /home/you/Applications/django/django SITE-PACKAGES-DIR/django
And make sure the django-admin script is in the PATH
sudo ln -s /home/you/Applications/django/django/bin/django-admin.py /usr/local/bin
I have used the ~/Applications/django directory because that's the way I like it, but you can of course place it anywhere you like it.
In any case, make sure you use the full path to the directory when making the symbolic links. Do not use relative directories such as ./django.
More information: alternative version using the official svn repository instead of git.
Installing the server:
sudo apt-get install postgresql
Installing pgAdmin III (a front-end, "essential for beginners" :D)
sudo apt-get install pgadmin3
Enable access for your username (replace $USER with your username):
sudo -u postgres createuser --superuser $USER sudo -u postgres psql
Now to change the postgres password for this user (again replace $USER with your username):
enter the desired password when prompted, CTRL+D to exit the prompt.
We need to create our own database, which takes the same name than our user's name:
And we should now be able to connect to the prompt:
(if you don't create the database before running psql, you'll get a psql: FATAL: database "$USER" does not exist error)
To connect using pgAdmin III, you can launch it by going to Applications--Programming--pgAdmin III or using the command line with the pgadmin3 command.
Now we need to tell pgAdmin about the local server, i.e. we'll create a new connection. Press the plug button or select the File--Add server... option, and fill the fields with the following values:
- Name = localhost
- Host = 127.0.0.1
- Maintenance DB = your user name
- User name = your user name
- Password = the password you entered before
... and press OK!
For some unknown reason I got this error: Error connecting to the server: fe_sendauth: no password supplied the first time I tried to connect. I got the same dialog and reentered the password, and then it worked.
More information: the official Ubuntu installation instructions in their community wiki.
This module allows django to connect to postgres. Otherwise you'll get errors such as
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: No module named psycopg2
sudo apt-get install python-psycopg2