indygo is a pastescript template and wrapper for a complete django development environment. To get started, create a clone of this repo and run $ sudo python setup.py develop in the top directory. After this you can start creating projects with $ indygo <yourprojectname> File Structure: =============== Your project should now have the following directory tree. / +---/apps ----------------------- project-specific applications +---/bootstrap ------------------ scripts and files to setup a dev environment | +---bootstrap.py ------------ main bootstrapping script | +---dependencies.txt -------- a list of python packages that this project depends on (pip) | +---setup_pip_virtualenv.sh-- | +---setup_ubuntu_packages.sh- +---/compass -------------------- compass' root directory with *.scss files under src. | +---/src | | +---ie.scss | | +---print.scss | | +---screen.scss | +---config.rb +---/db ------------------------- db-specific folder. By default settings.development stores a sqlite db here +---/dev ------------------------ scripts to aid during development and running servers | +---__init__.py | +---killsupervisor.py ------- script to shutdown the running supervisor daemon started with runsupervisor.py | +---runserver.py ------------ run django's development server | +---runsupervisor.py -------- run a supervisord daemon which automatically starts wsgi servers (runwsgi.py) | +---runwsgi.py -------------- run a gevent-based wsgi server customized for django | +---syncdb.py --------------- wrapper to manage.py syncdb. with "--noinput" and loading of fixtures | +---work -------------------- helper script to run compass in the background and supervisord in development mode +---/etc ------------------------- configuration files for various 3rd party services in production | +---/nginx ------------------- nginx specific configuration files | | +---development.conf ----- root folder points to this project folder by default | | +---production.conf ------ deployment server-specific configuration. don't forget to change the root folder | +---/supervisor -------------- supervisord-specific config files | | +---development.conf | | +---production.conf +---/fabfile --------------------- scripts and files for the deployment process | +---__init__.py -------------- Fabric configuration file. set USER and HOST here. (REPO_DIR, SITE_DIR optional) +---/fixtures -------------------- fixtures | +---/development | +---/production +---/lib ------------------------- non-django-specific, python-general package to store 3rd party libraries (or your own) | +---__init__.py | +---async.py ----------------- processes that run in a microthread under gevent (eg changemonitor) | +---cmd.py ------------------- various functions to launch command-line tools, used by the other scripts (dev) +---/media ----------------------- django's media folder | +---/site | | +---/css | | | +---ie.css | | | +---print.css | | | +---screen.css | | +---/img | | | +---grid.png | | +---/js | | | +---jquery-1.4.2.min.js +---/settings | +---__init__.py | +---common.py ----------------- common and shared settings | +---development.py ------------ development specific settings | +---production.py ------------- production specific settings +---/templates | +---/site | | +---base.html ------------- base layout to extend | | +---index.html +---/tmp -------------------------- directory to store various runtime files (supervisord's pid, logs etc) +---.gitignore +---manage.py +---README +---urls.py Requirements ============ During development you'll need the following packages: - compass, to change the source (*.scss) files and to compile those to css. - http://www.compass-style.org - git - http://git-scm.com/ - pip & virtualenv - http://pip.openplans.org/ & http://virtualenv.openplans.org/ - libevent (sudo apt-get install libevent-dev) - http://www.monkey.org/~provos/libevent/ - nginx (sudo apt-get install nginx) http://nginx.org/en/ For deployment you can ignore compass. Quick Start =========== Go into your new project and run $ ./bootstrap/bootstrap.py this will setup a virtualenv under virtualenv and install all the dependencies under bootstrap/dependencies.txt $ source virtualenv/bin/activate to activate virtualenv, and finally $ ./dev/work To start working Quick Deployment ================ -- do an initial commit of your project with git. There is a .gitignore supplied. You can just add all the files in interactive mode. -- adjust etc/nginx/production.conf to suit your needs (namely port, root to the project directory) -- adjust settings/production.py (namley DATABASE) -- setup ssh key authentication on your deployment server (if not already done) -- change the variables in fabfile/__init__.py (HOST, USER) $ fab bootstrap $ fab deploy fab bootstrap will create a bare git repo, add this repo to your local git, create the site structure, call bootstrap/bootstrap.py remotely, and enable nginx pointing to this project. fab deploy pushes your local git state to the remote repo, run supervisord if it's not already running and restart all associated wsgi servers Don't forget to activate the virtualenv as all the important scripts are stored under virtualenv (fab, pip) and won't work without activation. Your site should be ready now. Enjoy! Open the README file under your project directory for more information.