1.
#sudo apt-get install python-setuptools
2. Instal virtual environment
sudo easy_install virtualenv==1.10.1
(or a more recent version)
3. Create a virtual environment the name of mine is 'dd'
#virtualenv --no-site-packages dd
4. Activate the virtual enviroment, you have to do this everytime you want to start your server.
#source dd/bin/activate
5.
You will see now that at the left of your prompy the virtualenv is activated
(dd)#
7. Go to dd directory which is our root system for the created virtual env
# cd dd
6. It is time to install Django
#easyinstall Django
7. Once installed you can find some django scripts in bin directory:
(dd)alex@tic:~/dd$ pwd
/home/alex/dd
(dd)alex@tic:~/dd$ ls bin/
activate activate_this.py easy_install-2.7 python
activate.csh django-admin.py pip python2
activate.fish easy_install pip-2.7 python2.7
(dd)alex@tic:~/dd$
8. You can see the djanho help and its options
(dd)alex@tic:~/dd$ django-admin.py
Usage: django-admin.py subcommand [options] [args]
Options:
-v VERBOSITY, --verbosity=VERBOSITY
Verbosity level; 0=minimal output, 1=normal output,
2=verbose output, 3=very verbose output
--settings=SETTINGS The Python path to a settings module, e.g.
"myproject.settings.main". If this isn't provided, the
DJANGO_SETTINGS_MODULE environment variable will be
used.
--pythonpath=PYTHONPATH
A directory to add to the Python path, e.g.
"/home/djangoprojects/myproject".
--traceback Raise on exception
--version show program's version number and exit
-h, --help show this help message and exit
Type 'django-admin.py help <subcommand>' for help on a specific subcommand.
Available subcommands:
[django]
check
cleanup
compilemessages
createcachetable
dbshell
diffsettings
dumpdata
flush
inspectdb
loaddata
makemessages
runfcgi
runserver
shell
sql
sqlall
sqlclear
sqlcustom
sqldropindexes
sqlflush
sqlindexes
sqlinitialdata
sqlsequencereset
startapp
startproject
syncdb
test
testserver
validate
(dd)alex@tic:~/dd$
#(dd)alex@tic:~/dd$ django-admin.py startproject first_project
(dd)alex@tic:~/dd$ ls f*
first_project manage.py
(dd)alex@tic:~/dd$
10. Go to yout new project directory and runserver:
(dd)alex@tic:~/dd$ cd first_project/
(dd)alex@tic:~/dd/first_project$ ls
first_project manage.py
(dd)alex@tic:~/dd/first_project$ python manage.py runserver
Validating models...
0 errors found
August 17, 2014 - 01:00:09
Django version 1.6.5, using settings 'first_project.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
11. Go to your web browser and type the address shown above:
http://127.0.0.1:8000/
You will see something like:
It worked!
Congratulations on your first Django-powered page.
Of course, you haven't actually done any work yet. Next, start your first app by running
python manage.py startapp [appname]
.
You're seeing this message because you have
DEBUG = True
in your Django settings file and you haven't configured any URLs. Get to work!
12. Hit Ctrl+C to stop your server
13. end your virtual environment session
#deactivate and you will loose the (dd) environment from step 5
Enjoy!
.Alex
P.S. The first flags were used to assist military co-ordination on battlefields