A minimal django project template we use at ikraft for almost all of our projects.
Please add issues for any feedback.
Use following command to use it in your own project:
$ django-admin.py startproject testproject --template=https://github.com/ikraft/django-project-template/zipball/master
Inline comments should be self explainatory.
.
|-- apps -----------------------(Holds our apps)
|-- assets ---------------------(Sitewide static assets managed by compass/sass)
| |-- config.rb
| |-- css
| |-- img
| |-- js
| `-- sass
|-- data -----------------------(Any data files required in the project)
|-- docs -----------------------(Install Documentation)
| |-- INSTALL.txt
| |-- README.txt
| `-- requirements -----------(pip requirements)
| |-- common.txt
| |-- production.txt
| |-- staging.txt
| `-- sample-local.txt
|-- etc ------------------------(External configuration)
| |-- apache
| |-- gunicorn
| |-- nginx
| `-- supervisor
|-- logs
| |-- apache
| |-- project_name ------------(Logs generated by our django project. Directory name replaced by actual project name)
| |-- gunicorn
| |-- nginx
| `-- supervisor
|-- libs -----------------------(Any external libs that need customization)
| `-- __init__.py
|-- manage.py
|-- project_name --------------(project_name will be replated by the project name provided to django-admin.py)
| |-- settings --------------(django Settings module)
| | |-- common.py
| | |-- dist-settings.py
| | |-- local-sample.py
| | |-- production.py
| | `-- staging.py
|-- public --------------------(STATIC_ROOT)
| `-- uploads -- uploads ---------------(MEDIA_ROOT)
`-- templates
`-- base.html
Althought not required, we generate all stylesheets using a Compass/SASS.
On an Ubuntu 12.04 machine, compass can be installed with following commands:
sudo apt-get install ruby1.9.1-full sudo gem update --system sudo gem install compass
Once installed, just
cd /path/to/project/assets compass watch
That's it!
Check out compass website http://compass-style.org for detailed documentation.
We do not use runtime compilation for e.g, via django-compressorm to compile sass files. We simply use compass watch command. We found this method much simpler and easy to manage/maintain.
Step 1: Install bootstrap-sass gem
There are many SASS/Compass ports of Bootstrap but we prefer https://github.com/thomas-mcdonald/bootstrap-sass.
sudo gem install bootstrap-sass
Step 2: Add bootstrap to compass config
Add following line to the top of /path/to/project/assets/config.rb
require 'bootstrap'
Step 3: Install bootstrap in the project
cd /path/to/project/assets compass install bootstrap
Step 4: Add bootstrap to your styles*
Add following line at the to of your SASS/SCSS files:
@import bootstrap
For responsive designs add following line, which won't be needed when Bootstrap v3 is released.
@import bootstrap-responsive
Same as Twitter Bootstrap; just replace the name of the gem and requires to zurb-foundation. See http://foundation.zurb.com/docs/compass.php for more details.
Note
The following text will become the README.rst of the new project. Everything above this will not be included in README.rst
To bootstrap the project on a Ubuntu machine with PostgreSQL:
$ sudo apt-get install build-essential python2.7-dev postgresql postgresql-server-dev-all
$ mkvirtualenv {{ project_name }}
$ workon {{ project_name }}
$ cd path/to/{{ project_name }}
$ pip install -r requirements/dev.txt
$ cp {{ project_name }}/settings/local-example.py {{ project_name }}/settings/local.py
$ ./manage.py syncdb --migrate