
Installing Django
Truth be told, it is rather easy to get a test server up and running using the packaged web server that comes right with Django Trunk, but in this tutorial, I do throw in the apt-get install commands to install apache2 and mysql, but actually getting a production server up and running using mod_python and mysql is beyond the scope of this document. It also is unecessary, because Django has some phenominal documation, and I highly recommend continuing on with your Django education at both Django.com and www.djangobook.com
Django on Hardy
sudo apt-get install apache2 mysql-server
setup the root password for mysql durring the install. Dont forget it
Once setup is complete, log into mysql
Here, we create the database and User for Django in MySQL
mysql -u root -p
create database django1;
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON django1.* TO 'djangouser'@'localhost' IDENTIFIED BY 'differentpasswordthenroot';
And now lets install the connectors for Python and apache2, MySQL and sqlite.
sudo apt-get install python-mysqldb python-sqlite libapache2-mod-python
And, lets install subversion, and then pull the Django Code from trunk. This is the recommended way to install Django.
sudo apt-get install subversion
svn co http://code.djangoproject.com/svn/django/trunk/
Now, it says in the documentation that you do not need to run setup.py for a trunk install, but I did anyway, and things work perfectly.
cd trunk
sudo python setup.py install
You should see setup complete without errors.
Now create your first site
django-admin.py startproject firstsite
Verify everything is running by doing
python manage.py runserver
then navigate to http://127.0.0.1:8000
You should see a nice message that everything is working properly, and how to continue, however, I highly recommend reading the django book, at
http://www.djangobook.com
References:
http://www.djangobook.com/en/1.0/chapter02/
http://timsloan.blogspot.com/2008/03/setting-up-for-django-development-o...
