django-project-skeleton
文件大小: unknow
源码售价: 5 个金币 积分规则     积分充值
资源说明:A basic scaffold for Django projects
# Django Skeleton

## What is a Django skeleton
It's a basic structure which can serve as a base for your Django projects.

## Requirements
* Django 1.3
* Linux OS

## The included directories
* _project_ - the source code
	* contains all the Django custom applications and settings
	* "project/apps" hosts the custom applications
	* "project/settings" includes the settings for various environments.
	* "project/settings/settings.py" is the file created by the "django-admin.py" tool, the rest of the settings file will import/extend this one.
	* the code from "ipy_user_conf.py" will import all the models when one executes "python manage.py shell" and "ipython" is available
	* "manage.py" must receive the "--settings" argument (please see the usage below)
* _static_ - the Django's STATIC_ROOT directory
* _media_ - the Django's MEDIA_ROOT directory
* _env_ - virtualenv or buildout environment files
* _help_ - files related to the project, tutorials, photoshop files, etc
* _setup_ - files necessary to setup the project inside various environments
* _logs_ - the logs

## Optional directories
* _database_ - this is the parent location of your sqlite database, if case

## Principles of this file layout
* all project files are placed under the same parent
* keep the project's files in a logical and easy to find structure
* isolate the environment files so they don't mix with the project
* easy to decide which directories are to be kept on GIT

## Goodies included
* YUI reset and fonts CSS is being used
* a basic CSS file built with lesscss.org
* the base template is using a grid layout based on YUI Grids
 
## Setup the project with virtualenv and pip
* $ cd /project_name
* $ git clone git@github.com:florentin/django-skeleton.git .
* $ virtualenv env --no-site-packages
* $ source ./env/bin/activate
* $ mkdir -p database
* $ pip install -r ./setup/requirements/production.txt
* $ pip install -r ./setup/requirements/development.txt

## Setup the database
* $ cd /project_name/
* $ source ./env/bin/activate
* $ python ./project/manage.py syncdb --settings=settings.development --noinput
* $ python ./project/manage.py createsuperuser --settings=settings.development --email=admin@admin.com --username=admin
* $ Password: admin

## Start the lightweight development server included with Django
* $ cd /project_name/
* $ source ./env/bin/activate
* $ python ./project/manage.py runserver --settings=settings.development --nostatic
* or the hard way:
* $ export PYTHONPATH="./project:${PYTHONPATH}"; export PYTHONPATH="./project/apps:${PYTHONPATH}"; export DJANGO_SETTINGS_MODULE=settings.development; django-admin.py runserver --nostatic

## Aliases
You have probably noticed the long line needed to run the commands though the "manage.py".
One solution is to create a bash function in .bash_aliases:

dj() { python ./project/manage.py $@ --settings=settings.development; }

Usage:

$ dj runserver --nostatic

本源码包内暂不包含可直接显示的源代码文件,请下载源码包。