-
Install python 2.7, setuptools and virtualenvwrapper
$ sudo apt-get install python2.7 python-dev python-setuptools virtualenvwrapper
-
Install postgreSQL
$ sudo apt-get install postgresql-server-dev-9.1
-
Create database user
$ sudo su - postgres # Switch to user postgres $ createuser -s -E -P <my_db_user> # Create database user named 'my_db_user' (superuser, encrypted password, password prompt)
-
Allow user to connect and restart postgresql
-
Edit
/etc/postgresql/9.1/main/pg_hba.conf
-
Add the following line (so your user is allowed to connect from localhost) to
/etc/postgresql/9.1/main/pg_hba.conf
IMPORTANT: Do not blindly copy these lines at the end of the file. Rather copy it into the appropriate section saying:# Put your actual configuration here
local my_db_user my_db_user password
… or on your development machine
local all all trust host all all 127.0.0.1/32 trust
Restart postgres:
/etc/init.d/postgresql restart
and logout user 'postgres':logout
-
-
Install PIL dependencies
$ sudo apt-get install libjpeg8 libjpeg8-dev libfreetype6 libfreetype6-dev zlib1g-dev
Ubuntu has it's libraries where PIL does not find it, so you will have to make some link to them so PIL can be installed:
$ sudo ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib $ sudo ln -s /usr/lib/x86_64-linux-gnu/libfreetype.so /usr/lib $ sudo ln -s /usr/lib/x86_64-linux-gnu/libz.so /usr/lib
(see also http://jj.isgeek.net/2011/09/install-pil-with-jpeg-support-on-ubuntu-oneiric-64bits/)
-
Make, enter and activate a virtualenv:
$ mkvirtualenv <my_project> -p python2.7 New python executable in <my_project>/bin/python Installing setuptools............done. $ workon <my_project>
-
Clone this repo into a sub-directory of the new virtualenv:
$ git clone 'git://github.com/stephanpoetschner/django-skeleton-project.git' <project_folder> $ cd <project_folder>/ $ git mv <my_project> <custom_project_name> # Remove .empty files, used to make Hg track otherwise-empty dirs. $ find . -name '.empty' -exec rm {} \; # edit or clear .gitignore $ vi .gitignore $ echo > .gitignore
-
Remove the pointer to the GitHub project:
$ git config --unset remote.origin.url
Later you’ll probably want to re-add this configuration with a pointer to your upstream repo. You can do that with the following command:
$ git config remote.origin.url '[email protected]:USERNAME/PROJECT.git'
-
Install base requirements
$ easy_install pip $ pip install -r requirements.txt
-
Ensure current (working) version numbers are documented
$ pip freeze > requirements.txt
As you edit your
requirements.txt
file, you can run that install command again;pip install
will realise which packages you’ve added and will ignore those already installed. -
Delete this subsection of the
README.md
file -
Commit changes to new repository
$ git commit -a
-
Make, enter and activate a virtualenv:
$ mkvirtualenv <my_project> -p python2.7 New python executable in <my_project>/bin/python Installing setuptools............done. $ workon <my_project>
-
Install requirements (pre-requirement: python-setuptools)
$ easy_install pip $ pip install -r requirements.txt
-
Copy
localsettings.py.skel
tolocalsettings.py
-
Go through the following files, editing as necessary:
localsettings.py
settings.py
- Update SECRET_KEY (call
./manage.py generate_secret_key
)
- Update SECRET_KEY (call
-
Create initial postgres-database
$ createdb --owner <my_db_user> <my_database>
-
Sync the database with the apps model
$ fab reset
or
$ ./manage.py syncdb
-
Run the test-suite
$ ./manage.py test
-
Start the devserver
$ ./manage.py runserver