- Notifications
You must be signed in to change notification settings - Fork0
The sample project layout from the book, "Two Scoops of Django: Best Practices for Django 1.5"
License
hguochen/django-twoscoops-project
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A project template for Django 1.5.
To use this project follow these steps:
- Create your working environment
- Install Django
- Create the new project using the django-two-scoops template
- Install additional dependencies
- Use the Django admin to create the project
note: these instructions show creation of a project called "icecream". Youshould replace this name with the actual name of your project.
You have several options in setting up your working environment. We recommendusing virtualenv to separate the dependencies of your project from your system'spython environment. If on Linux or Mac OS X, you can also use virtualenvwrapper to help manage multiple virtualenvs across different projects.
First, make sure you are using virtualenv (http://www.virtualenv.org). Oncethat's installed, create your virtualenv:
$ virtualenv --distribute icecream
You will also need to ensure that the virtualenv has the project directoryadded to the path. Adding the project directory will allow django-admin.py tobe able to change settings using the --settings flag.
In Linux and Mac OSX, you can install virtualenvwrapper (http://virtualenvwrapper.readthedocs.org/en/latest/),which will take care of managing your virtual environments and adding theproject path to the site-directory for you:
$ mkdir icecream$ mkvirtualenv -a icecream icecream-dev$ cd icecream && add2virtualenv `pwd`
In Windows, or if you're not comfortable using the command line, you will needto add a .pth file to the site-packages of your virtualenv. If you havebeen following the book's example for the virtualenv directory (pg. 12), thenyou will need to add a python pathfile named _virtualenv_path_extensions.pthto the site-packages. If you have been following the book, then yourvirtualenv folder will be something like:
`~/.virtualenvs/icecream/lib/python2.7/site-directory/`
In the pathfile, you will want to include the following code (fromvirtualenvwrapper):
import sys; sys.__plen = len(sys.path)/home/<youruser>/icecream/icecream/import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p+len(new)
To install Django in the new virtual environment, run the following command:
$ pip install django
To create a new Django project called 'icecream' usingdjango-twoscoops-project, run the following command:
$ django-admin.py startproject --template=https://github.com/twoscoops/django-twoscoops-project/archive/master.zip --extension=py,rst,html icecream
Depending on where you are installing dependencies:
In development:
$ pip install -r requirements/local.txt
For production:
$ pip install -r requirements.txt
note: We install production requirements this way because many Platforms as aServices expect a requirements.txt file in the root of projects.
- Many thanks to Randall Degges for the inspiration to write the book and django-skel.
- All of thecontributors to this project.
About
The sample project layout from the book, "Two Scoops of Django: Best Practices for Django 1.5"
Resources
License
Uh oh!
There was an error while loading.Please reload this page.