I started learning DJango for the first time. I have some amount of basic knowledge of python but DJango is first for me. I started with the documentation page of django, bu
Assuming you're using linux, you should be able to get the Python setuptools from your distribution's repositories. Once installed, type
sudo easy_install pip # installs pip
sudo pip install -U pip # upgrades pip to most recent version
From there, you can continue to follow the tutorial.
If you're not using linux, download Python setuptools from PyPI. Python setuptools [PyPI]
For OS X, the above should still work in the terminal. On windows, you may have to do the above from an elevated command prompt (not sure), but without the sudo
command at the beginning.
The most flexbile way, IMO, of installing w/o old setuptools, is
$ curl -O http://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.7.1.2.tar.gz
tar xzf virtualenv-1.7.1.2.tar.gz
$ python2.7 virtualenv-1.7.1.2/virtualenv.py --distribute ~/env
$ source ~/env/bin/activate
pip install Django
~/env/lib/python2.7/site-packages/django
.pip install -e svn+http://code.djangoproject.com/svn/django/trunk
~/env/src/django/django
. Then you are free to read the source or modify it. Also, you could have full documents by make html
in ~/env/src/django/docs
Things installed by the above method are totally local, you don't need to type sudo or take the risk of messing up paths such as /usr/local/lib
, even more, you could then be able to install multiple versions of Django or Python w/o affect each other!
Furthermore, you could try virtualenvwrapper.
SQLite is included with Python 2.5+. You should be able to edit your settings.py file with the relevant database settings (database type and filename, see official docs for details), and your database will then be created upon next running syncdb.
There is a great tutorial on working with virtualenvs and Django at http://bartek.im/blog/2010/07/13/django-environment.html
I also highly recommend virtualenv-burrito to simplify the installation (and updating) process for virtualenv and virtualenvwrapper: https://github.com/brainsik/virtualenv-burrito
If you are still facing issues, do you get any errors when running syncdb at present? If so, what are they?
Do not use sudo with virtualenv this is the easiest way to multiple problems later.
Begin by installing virtualenv
- sudo apt-get install python-virtualenv
Next, as your normal user run the following commands:
$ virtualenv --no-site-packages django-env
$ source django-env/bin/activate
(django-env)$ pip install django
(django-env)$ django-admin.py startproject myproject
(django-env)$ cd myproject
(django-env)/myproject$ nano settings.py
settings.py
, after 'ENGINE:'
type 'django.db.backends.sqlite3',
(don't forget the comma)settings.py
, after the 'NAME:'
type 'site.db',
(again, don't forget the comma)(django-env)/myproject$ python manage.py syncdb