-
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.confIMPORTANT: Do not blindly copy these lines at the end of the file. Rather copy it into the appropriate section saying:# Put your actual configuration herelocal my_db_user my_db_user password… or on your development machine
local all all trust host all all 127.0.0.1/32 trustRestart postgres:
/etc/init.d/postgresql restartand logout user 'postgres':logout
-
-
Install PIL dependencies
$ sudo apt-get install libjpeg8 libjpeg8-dev libfreetype6 libfreetype6-dev zlib1g-devUbuntu 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.urlLater 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.txtAs you edit your
requirements.txtfile, you can run that install command again;pip installwill realise which packages you’ve added and will ignore those already installed. -
Delete this subsection of the
README.mdfile -
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.skeltolocalsettings.py -
Go through the following files, editing as necessary:
localsettings.pysettings.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 resetor
$ ./manage.py syncdb -
Run the test-suite
$ ./manage.py test -
Start the devserver
$ ./manage.py runserver