Commits

Anonymous committed 9b19a69

Moved scripts one up

  • Participants
  • Parent commits 94d9e5d

Comments (0)

Files changed (6)

+django-environments
+===================
+
+Manage different settings for different locations (machines), or
+Fabric's 'roles', like local (your machine), development (shared
+development system), test, staging/acceptance and production.
+
+Compatibility with virtualenv
+==============================
+
+Please note django-environments can be nicely used together with
+virtualenv, especially virtualenvwrapper's bin/postactivate script.
+
+Getting Started
+===============
+
+This is a fully working Django project. You can copy files from it
+as needed to your own projects.
+
+ 1. Copy scripts/initenv_example to scripts/initenv.
+ 2. Edit initenv and set ``PROJECT_ROOT``, ``DJANGO_PROJECT`` (always a
+    subdirectory of ``PROJECT_ROOT``) and ``PROJECT_SETTINGS``.
+ 3. Activate the environment using ``source scripts/initenv``.
+ 4. When using virtualenv with virtualenvwrapper, you can do 
+    ``source <path-to-project>/scripts/initenv`` from bin/postactivate.
+
+If everything works okay, the following shell aliases are created:
+
+ * cdroot - go to project root.
+ * cdjango - go to django project root (one lower than project root).
+ * runserver - perform manage.py runserver with the correct settings.
+
+Directories
+===========
+
+ * The mysite/settings directory replaces settings.py and contains
+   the default settings in generic.py, which is imported in __init__.py.
+ * The mysite/settings/env directory contains the different settings
+   files for every environment
+ * All .wsgi files in the mysite/apache folder are equal; their
+   respective filenames are used to determine which settings to import.
+ * As discussed above, the scripts directory contains the shell
+   scripts intended to be sourced with the ``source`` command.
+
+Remarks
+=======
+
+ * manage.py is just there to make this a complete django project.
+ * urls.py is just there to demonstrate the ``SERVE_MEDIA`` setting.

mysite/README

-django-environments
-===================
-
-Manage different settings for different locations (machines), or
-Fabric 'roles', like local (your machine), development (shared
-development system), test, staging/acceptance and production.
-
-Compatibility with virtualenv
-==============================
-
-Please note django-environments can be used together with virtualenv,
-especially virtualenvwrapper's bin/postactivate script.
-
-Getting Started
-===============
-
-This is a fully working Django project. You can copy files from it
-as needed to your own projects.
-
- 1. Copy scripts/initenv_example to scripts/initenv
- 2. Edit initenv and set ``PROJECT_ROOT``, ``DJANGO_PROJECT`` (always a
-    subdirectory of ``PROJECT_ROOT``) and ``PROJECT_SETTINGS``
- 3. Activate the environment using ``source scripts/initenv``
- 4. When using virtualenv with virtualenvwrapper, you can do 
-    ``source <path-to-project>/scripts/initenv`` from bin/postactivate
-
-If everything works okay, the following shell aliases are created:
-
- * cdroot - go to project root
- * cdjango - go to django project root (one lower than project root)
- * runserver - perform manage.py runserver with the correct settings
-
-Directories
-===========
-
- * As discussed above, the scripts directory contains the shell
-   scripts intended to be sourced with the ``source`` command.
- * The settings/env directory contains the different settings files for every
-   environment
- * All .wsgi files in the apache folder are equal; their respective filenames
-   are used to determine which settings to import.
-
-Remarks
-=======
-
- * manage.py is just there to make this a complete django project
- * urls.py is just there to demonstrate the ``SERVE_MEDIA`` setting

mysite/scripts/initenv_example

-# Initialize the environment
-# Should be sourced with the 'source' command, e.g. 'source initenv'
-# This can be done from virtualenvwrapper's bin/postactivate
-
-PROJECT_ROOT=/Users/grone/repos/django-environments
-DJANGO_PROJECT=mysite
-PROJECT_SETTINGS=settings.env.local
-SHOW_DJANGO_ENVIRONMENT=yes
-
-source $PROJECT_ROOT/$DJANGO_PROJECT/scripts/initenv_generic

mysite/scripts/initenv_generic

-# Set the following variables in your bin/postacivate, then source
-# this file
-
-# The root of the project, i.e. the directory containing your Django
-# project
-#PROJECT_ROOT=/Users/joe/projects/myproject
-
-# Set this to the name of the Django project in PROJECT_ROOT
-#DJANGO_PROJECT=mysite
-
-# Set this to something that can be imported within DJANGO_PROJECT, like 'settings'
-#PROJECT_SETTINGS=settings
-
-# The root of the project should exist, of course
-[ -z "$PROJECT_ROOT" ] && echo "Variable PROJECT_ROOT not set or empty" 2>&1 && return 1
-[ ! -d "$PROJECT_ROOT" ] && echo "Variable PROJECT_ROOT does not point to a readable directory" 2>&1  && return 1
-
-# Check Django project as well
-[ -z "$DJANGO_PROJECT" ] && echo "Variable DJANGO_PROJECT not set or empty" 2>&1 && return 1
-[ ! -d "$PROJECT_ROOT/$DJANGO_PROJECT" ] && echo "Variable DJANGO_PROJECT does not identify a readable directory within $PROJECT_ROOT" 2>&1  && return 1
-
-# If no particular settings are defined, just use the "base" settings
-if [ -n "$PROJECT_SETTINGS" ]; then
-    DJANGO_SETTINGS_MODULE=$DJANGO_PROJECT.$PROJECT_SETTINGS
-else
-    DJANGO_SETTINGS_MODULE=$DJANGO_PROJECT.settings
-fi
-
-# Set the PYTHONPATH to include PROJECT_ROOT
-PYTHONPATH=$PROJECT_ROOT:$PYTHONPATH
-
-export PYTHONPATH DJANGO_SETTINGS_MODULE
-
-# Test settings import
-python -c "import $DJANGO_SETTINGS_MODULE" > /dev/null 2>&1
-[ ! "$?" -eq 0 ] && echo "Error importing settings $DJANGO_SETTINGS_MODULE (PYTHONPATH: $PYTHONPATH)" 2>&1 && return 1
-
-# Some useful aliases
-alias runserver="python $PROJECT_ROOT/$DJANGO_PROJECT/manage.py runserver --settings $DJANGO_SETTINGS_MODULE"
-alias cdroot="cd $PROJECT_ROOT"
-alias cdjango="cd $PROJECT_ROOT/$DJANGO_PROJECT"
-
-# Change working directory
-cdjango
-
-# Show environment info
-if [ "$SHOW_DJANGO_ENVIRONMENT" = "yes" ]; then
-    echo Welcome to $DJANGO_PROJECT. Environment info:
-    echo PROJECT_ROOT: \'$PROJECT_ROOT\'
-    echo DJANGO_PROJECT: \'$DJANGO_PROJECT\'
-    echo DJANGO_SETTINGS_MODULE: \'$DJANGO_SETTINGS_MODULE\'
-    echo PYTHONPATH: \'$PYTHONPATH\'
-    echo
-    echo Django settings:
-    PAGER=cat python -c "import $DJANGO_SETTINGS_MODULE; help($DJANGO_SETTINGS_MODULE)" | grep -v "^$"
-    echo
-fi

scripts/initenv_example

+# Initialize the environment
+# Should be sourced with the 'source' command, e.g. 'source initenv'
+# This can be done from virtualenvwrapper's bin/postactivate, but
+# it's easier to just copy the following lines to bin/postactivate:
+
+PROJECT_ROOT=/Users/grone/repos/django-environments
+DJANGO_PROJECT=mysite
+PROJECT_SETTINGS=settings.env.local
+SHOW_DJANGO_ENVIRONMENT=yes
+
+source $PROJECT_ROOT/scripts/initenv_generic

scripts/initenv_generic

+# Set the following variables in your bin/postactivate, then source this file
+
+# The root of the project, i.e. the directory containing your Django project
+#PROJECT_ROOT=/Users/joe/projects/myproject
+
+# Set this to the name of the Django project in PROJECT_ROOT
+#DJANGO_PROJECT=mysite
+
+# Set this to something that can be imported within DJANGO_PROJECT, like 'settings'
+#PROJECT_SETTINGS=settings
+
+# The root of the project should exist, of course
+[ -z "$PROJECT_ROOT" ] && echo "Variable PROJECT_ROOT not set or empty" 2>&1 && return 1
+[ ! -d "$PROJECT_ROOT" ] && echo "Variable PROJECT_ROOT does not point to a readable directory" 2>&1  && return 1
+
+# Check Django project as well
+[ -z "$DJANGO_PROJECT" ] && echo "Variable DJANGO_PROJECT not set or empty" 2>&1 && return 1
+[ ! -d "$PROJECT_ROOT/$DJANGO_PROJECT" ] && echo "Variable DJANGO_PROJECT does not identify a readable directory within $PROJECT_ROOT" 2>&1  && return 1
+
+# If no particular settings are defined, just use the "base" settings
+if [ -n "$PROJECT_SETTINGS" ]; then
+    DJANGO_SETTINGS_MODULE=$DJANGO_PROJECT.$PROJECT_SETTINGS
+else
+    DJANGO_SETTINGS_MODULE=$DJANGO_PROJECT.settings
+fi
+
+# Set the PYTHONPATH to include PROJECT_ROOT
+PYTHONPATH=$PROJECT_ROOT:$PYTHONPATH
+
+export PYTHONPATH DJANGO_SETTINGS_MODULE
+
+# Test settings import
+python -c "import $DJANGO_SETTINGS_MODULE" > /dev/null 2>&1
+[ ! "$?" -eq 0 ] && echo "Error importing settings $DJANGO_SETTINGS_MODULE (PYTHONPATH: $PYTHONPATH)" 2>&1 && return 1
+
+# Some useful aliases
+alias runserver="python $PROJECT_ROOT/$DJANGO_PROJECT/manage.py runserver --settings $DJANGO_SETTINGS_MODULE"
+alias cdroot="cd $PROJECT_ROOT"
+alias cdjango="cd $PROJECT_ROOT/$DJANGO_PROJECT"
+
+# Change working directory
+cdjango
+
+# Show environment info
+if [ "$SHOW_DJANGO_ENVIRONMENT" = "yes" ]; then
+    echo Welcome to $DJANGO_PROJECT. Environment info:
+    echo PROJECT_ROOT: \'$PROJECT_ROOT\'
+    echo DJANGO_PROJECT: \'$DJANGO_PROJECT\'
+    echo DJANGO_SETTINGS_MODULE: \'$DJANGO_SETTINGS_MODULE\'
+    echo PYTHONPATH: \'$PYTHONPATH\'
+    echo
+    echo Django settings:
+    PAGER=cat python -c "import $DJANGO_SETTINGS_MODULE; help($DJANGO_SETTINGS_MODULE)" | grep -v "^$"
+    echo
+fi