(You’ll find lots of this online. I’m just putting this up here for my personal reference.)
Hi there. I’m writing this with a Linux/Unix/OS X environment in mind. Basically, any OS that has a pretty powerful terminal. Don’t know how this goes for Windows…Cygwin maybe?
First off, make a virtualenv to work on and install Django. You need virtualenv and virtualenvwrapper. If you do not have them installed yet, do not despair. You can use virtualenv-burrito (and I do recommend that you use virtualenv-burrito). The readme of the GitHub repo linked is pretty self-explanatory so I won’t dwell much on that. I’ll just say that…
…if, after following the instructions for virtualenv-burrito, you still can’t invoke virtualenv commands, you might have to do
$ source /home/username/.venvburrito/startup.sh |
Or, better yet, just put that line in your .bashrc file (or equivalent).
And also, if you are a Python 3.x fan, Django does not work yet with Python 3.x .
So, make and work on a virtualenv by
$ mkvirtualenv env_name $ workon env_name |
While inside a virtualenv, install Django (note that, being in a virtualenv, you need to be in a virtualenv to use Django):
(env_name)$ pip install Django |
Create new projects by invoking
(env_name)$ django_admin.py startproject project_name |
This will create a directory named project_name . This directory has some Django-related files. Go to this directory. Start the server by
(env_name)$ python manage.py runserver |
And your set to create your web apps!
I’ve heard of Django long ago but what really got me started with it is PyCon Philippines. Here are Daniel Greenfeld’s notes on the PyconPH Django talk by Marconi Moreto, which was my primary reference in setting up my Django installation. However, I had a few deviations and personal discoveries, hence this blog post.