Django

From Hackepedia
Jump to navigationJump to search

Install on Debian

sudo apt-get install python-django

You can verify it's installed after by running:

$ python
Python 2.6.6 (r266:84292, Dec 26 2010, 22:31:48) 
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django;
>>> django.VERSION
(1, 2, 3, 'final', 0)
>>> quit();

and now to create and test our first app:

$ django-admin startproject test_project
$ cd test_project

Replace 1.2.3.4 in the following line with your IP:

$ python manage.py runserver 1.2.3.4:9090
Validating models...
0 errors found
Django version 1.2.3, using settings 'test_project.settings'
Development server is running at http://1.2.3.4:9090/
Quit the server with CONTROL-C.

and now you should be able to go into your browser and look at ttp://1.2.3.4:9090/ If everything worked, the page will read:

It worked!
Congratulations on your first Django-powered page.