Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 1921 lines (1601 sloc) 59.636 kb
#!/bin/bash
#
# Generates Django Project Skeletons Simply and Properly
# Justine Tunney <jtunney@lobstertech.com>
# Licensed MIT
#
PROJ=$1
[[ $PROJ ]] || ( echo "missing name!" >&2; exit 1 )
[[ $DEST ]] || DEST="."
[[ -d "$DEST/$PROJ" ]] && ( echo "$PROJ already exists!" >&2; exit 1 )
[[ $EMAIL ]] || EMAIL="$(git config user.email)"
[[ $EMAIL ]] || EMAIL="$USER@$(hostname -f)"
[[ $AUTHOR ]] || AUTHOR="$(git config user.name)"
[[ $AUTHOR ]] || AUTHOR="$USER"
[[ $DESCRIP ]] || DESCRIP="$PROJ"
[[ $LICENSE ]] || LICENSE="GNU AGPL v3 or later"
[[ $PIP_DOWNLOAD_CACHE ]] || export PIP_DOWNLOAD_CACHE="~/.pip/cache"
virtualenv $PROJ
cd $PROJ
source bin/activate
mkdir $PROJ
cd $PROJ
mkdir -p ../{run,static}
mkdir -p scripts
mkdir -p conf/{init.d,nginx}
mkdir -p doc/{_build,_static,_templates}
mkdir -p $PROJ/templates/$PROJ
mkdir -p $PROJ/templates/registration
mkdir -p $PROJ/static/{img,css,js}
mkdir -p $PROJ/static/$PROJ/{img,css,js}
mkdir -p $PROJ/management/commands
# shortcuts to avoid directory hell
ln -sf $PROJ/$PROJ ../code
ln -sf $PROJ/$PROJ/templates/$PROJ ../html
ln -sf $PROJ/$PROJ/templates/$PROJ ../html
ln -sf $PROJ/$PROJ/static/$PROJ/css ../css
ln -sf $PROJ/$PROJ/static/$PROJ/img ../img
ln -sf $PROJ/$PROJ/static/$PROJ/js ../js
echo "downloading ez_setup.py..."
wget -qO ez_setup.py http://peak.telecommunity.com/dist/ez_setup.py || exit 1
echo "downloading $PROJ/static/$PROJ/img/favicon.png..."
wget -qO $PROJ/static/$PROJ/img/favicon.png https://we.riseup.net/favicon.png || exit 1
echo "downloading $PROJ/static/js/jquery.js..."
wget -qO $PROJ/static/js/jquery.js http://code.jquery.com/jquery.js || exit 1
echo "downloading $PROJ/static/js/jquery.min.js..."
wget -qO $PROJ/static/js/jquery.min.js http://code.jquery.com/jquery.min.js || exit 1
echo "downloading $PROJ/static/js/modernizr.js..."
wget -qO $PROJ/static/js/modernizr.js http://modernizr.com/downloads/modernizr.js || exit 1
echo "downloading $PROJ/static/js/less.min.js..."
wget -qO $PROJ/static/js/less.min.js http://lesscss.googlecode.com/files/less-1.3.0.min.js || exit 1
echo "downloading $PROJ/static/js/coffee-script.min.js..."
wget -qO $PROJ/static/js/coffee-script.min.js http://coffeescript.org/extras/coffee-script.js || exit 1
pushd $PROJ/static >/dev/null 2>&1
echo "Installing Twitter Bootstrap from Git"
git clone https://github.com/twitter/bootstrap.git || exit $?
rm -rf bootstrap/.git
popd >/dev/null 2>&1
echo "generating .gitignore..."
cat >.gitignore <<EOF
settings_local.py
$PROJ/static/$PROJ/js/*.min.js
$PROJ/static/$PROJ/css/*.min.css
core
*.pyc
*.pyo
*.pyc
*.o
*.bak
*.db
*~
*.rej
*.orig
.figleaf*
*.egg-info
*.egg
._*
.DS_Store
Thumbs.db*
doc/_build
.figleaf*
*.egg-info
*.egg
build
deps
dist
pip-log.txt
*.sqlite3
EOF
echo "generating setup.py..."
cat >setup.py <<EOF
# http://packages.python.org/distribute/setuptools.html
# http://diveintopython3.org/packaging.html
# http://wiki.python.org/moin/CheeseShopTutorial
# http://pypi.python.org/pypi?:action=list_classifiers
from ez_setup import use_setuptools
use_setuptools(version="0.6c11")
import os
from setuptools import setup, find_packages
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
version = __import__("$PROJ").__version__
setup(
name = "$PROJ",
version = version,
description = "$DESCRIP",
long_description = read("README.rst"),
author = "$AUTHOR",
author_email = "$EMAIL",
license = "$LICENSE",
install_requires = ["Django>=1.4", "south", "django-reversion",
"python-memcached", "django-debug-toolbar",
"django-gravatar"],
packages = find_packages(),
include_package_data = True,
zip_safe = False,
scripts = ["scripts/" + f for f in os.listdir("scripts")
if not f.startswith(".")],
)
EOF
echo "generating README.rst..."
cat >README.rst <<EOF
.. -*-rst-*-
=$(echo $PROJ | sed s/./=/g)=
$PROJ
=$(echo $PROJ | sed s/./=/g)=
:name: $PROJ
:description: $DESCRIP
:copyright: © $(date +%Y) $AUTHOR
:license: $LICENSE
Usage
=====
Install from git into a virtualenv::
sudo chmod go+rwt /opt # let people create new files in /opt
cd /opt
virtualenv $PROJ
cd $PROJ
source bin/activate
git clone REPO_URL
make deps
make
How to run a debug server::
make dev && $PROJ-dev runserver
How to run a non-debug server::
make pro && $PROJ runserver
View the documentation::
firefox doc/_build/html/index.html
Production
----------
First you should update to the latest code and build everything::
git pull
make pro
Now install and configure nginx::
sudo apt-get install nginx
sudo ln -sf ../sites-available/$PROJ.conf /etc/nginx/sites-enabled
sudo /etc/init.d/nginx start
Start the backend gunicorn webserver::
sudo cp conf/init.d/$PROJ /etc/init.d
sudo /etc/init.d/$PROJ start
Now check it out by running ``firefox http://localhost/``!!!
You can also run gunicorn manually::
gunicorn_django --bind=127.0.0.1:7000 --workers=4 $PROJ/settings.py
When using PostgreSQL, it is strongly recommended that you configure pgbouncer
on your system to significantly reduce request latency and memory consumption.
Credits
=======
Thank you Justine Tunney for creating django-bone which helped me quickly
create the boilerplate skeleton for this project <3
EOF
echo "generating Makefile..."
cat >Makefile <<EOF
dev:
pip install sphinx pep8 pyflakes
pip install -e .
pep8 $PROJ/admin.py
pyflakes $PROJ/admin.py
pep8 $PROJ/middleware.py
pyflakes $PROJ/middleware.py
pep8 $PROJ/models.py
pyflakes $PROJ/models.py
pep8 $PROJ/views.py
pyflakes $PROJ/views.py
pep8 $PROJ/tests.py
pyflakes $PROJ/tests.py
pep8 $PROJ/management/commands/example.py
pyflakes $PROJ/management/commands/example.py
$PROJ-dev syncdb
$PROJ-dev migrate
$PROJ-dev test $PROJ
make -C doc html
pro:
pip install -e .
lessc $PROJ/static/$PROJ/css/$PROJ.less \\
$PROJ/static/$PROJ/css/$PROJ.css
lessc -x $PROJ/static/$PROJ/css/$PROJ.less \\
$PROJ/static/$PROJ/css/$PROJ.min.css
coffee -o $PROJ/static/$PROJ/js \\
$PROJ/static/$PROJ/js/$PROJ.coffee
uglifyjs -o $PROJ/static/$PROJ/js/$PROJ.min.js \\
$PROJ/static/$PROJ/js/$PROJ.js
uglifyjs -o $PROJ/static/js/modernizr.min.js \\
$PROJ/static/js/modernizr.js
make -C $PROJ/static/bootstrap bootstrap
cp $PROJ/static/bootstrap/bootstrap/js/bootstrap.min.js \\
$PROJ/static/js
$PROJ migrate
$PROJ collectstatic --noinput
deps:
apt-get install -y python python-dev python-setuptools
easy_install virtualenv pip
npm install -g less coffee-script coffeelint uglify-js
newdb:
rm -f $PROJ.sqlite3
make
$PROJ createsuperuser --username=$USER --email=$EMAIL
EOF
echo "generating scripts/$PROJ..."
cat >scripts/$PROJ <<EOF
#!/usr/bin/env python
import os
# ignore when django autoreloader restarts program
if os.environ.get("RUN_MAIN") != "true":
if not os.environ.get("DJANGO_SETTINGS_MODULE"):
os.environ["DJANGO_SETTINGS_MODULE"] = "$PROJ.settings"
from django.core.management import execute_from_command_line
from django.conf import settings
execute_from_command_line()
EOF
echo "generating scripts/$PROJ-dev..."
cat >scripts/$PROJ-dev <<EOF
#!/usr/bin/env python
import os
import sys
# ignore when django autoreloader restarts program
if os.environ.get("RUN_MAIN") != "true":
if os.environ.get("DJANGO_SETTINGS_MODULE"):
print >>sys.stderr, ("Overriding DJANGO_SETTINGS_MODULE not permitted "
"in development mode. Use $PROJ command "
"instead.")
sys.exit(1)
else:
os.environ["DJANGO_SETTINGS_MODULE"] = "$PROJ.settings_dev"
from django.core.management import execute_from_command_line
from django.conf import settings
execute_from_command_line()
EOF
echo "generating $PROJ/__init__.py..."
cat >$PROJ/__init__.py <<EOF
__version__ = "0.1"
EOF
echo "generating $PROJ/settings.py..."
cat >$PROJ/settings.py <<EOF
r"""
settings
$(echo settings | sed s/./~/g)
This file is used to configure Django.
"""
import os
import sys
from datetime import timedelta
from os.path import abspath, dirname, join, exists
from django.core.urlresolvers import reverse_lazy
project_root = dirname(abspath(__file__))
DEBUG = False
TEMPLATE_DEBUG = DEBUG
SECRET_KEY = "please change me to some wacky random value"
STATIC_ROOT = "/opt/$PROJ/static"
STATIC_URL = "/static/"
MEDIA_ROOT = "/opt/$PROJ/static/media"
MEDIA_URL = "/static/media/"
SITE_ID = 1
DEFAULT_CHARSET = "utf-8"
USE_I18N = True
USE_L10N = False
USE_THOUSAND_SEPARATOR = True
USE_TZ = True
TIME_ZONE = "US/Eastern"
ROOT_URLCONF = "$PROJ.urls"
SESSION_ENGINE = "django.contrib.sessions.backends.signed_cookies"
SESSION_COOKIE_HTTPONLY = True
USE_X_FORWARDED_HOST = True
LOGIN_REDIRECT_URL = reverse_lazy('index')
LOGIN_URL = reverse_lazy('login')
LOGOUT_URL = reverse_lazy('index')
BOLD = "\x1b[1m"
GREEN = "\x1b[32m"
RESET = "\x1b[0m"
ADMINS = (
("", "$EMAIL"),
)
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": "$PROJ.sqlite3",
},
}
CACHES = {
"default": {
"BACKEND": "django.core.cache.backends.memcached.MemcachedCache",
"KEY_PREFIX": project_root,
"LOCATION": [
"127.0.0.1:11211",
],
},
}
TEMPLATE_LOADERS = (
("django.template.loaders.cached.Loader", (
"django.template.loaders.filesystem.Loader",
"django.template.loaders.app_directories.Loader",
)),
)
MIDDLEWARE_CLASSES = [
"$PROJ.middleware.XForwardedForMiddleware",
"django.middleware.common.CommonMiddleware",
# "django.middleware.transaction.TransactionMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.locale.LocaleMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"$PROJ.middleware.CsrfCookieWhenLoggedIn",
"$PROJ.middleware.NeverCache",
]
TEMPLATE_CONTEXT_PROCESSORS = [
"django.contrib.auth.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.static",
"django.core.context_processors.debug",
"django.contrib.messages.context_processors.messages",
]
INSTALLED_APPS = [
"$PROJ",
"django.contrib.auth",
"django.contrib.contenttypes",
'django.contrib.staticfiles',
"django.contrib.sessions",
"django.contrib.admin",
"south",
"reversion",
"gravatar",
]
LOGGING = {
"version": 1,
"disable_existing_loggers": True,
"formatters": {
"verbose": {
"format": (GREEN + "%(asctime)s %(levelname)s %(name)s "
"%(filename)s:%(lineno)d " + RESET + "%(message)s"),
},
"simple": {
"format": GREEN + "%(levelname)s " + RESET + "%(message)s",
},
},
"handlers": {
"null": {
"level": "DEBUG",
"class": "django.utils.log.NullHandler",
},
"console": {
"level": "DEBUG",
"class": "logging.StreamHandler",
"formatter": "simple",
},
"mail_admins": {
"level": "ERROR",
"class": "django.utils.log.AdminEmailHandler",
"include_html": True,
},
},
"loggers": {
"django": {
"level": "WARNING",
"handlers": ["console"],
"propagate": True,
},
"django.request": {
"level": "WARNING",
"handlers": ["console", "mail_admins"],
"propagate": False,
},
"$PROJ": {
"level": "WARNING",
"handlers": ["console", "mail_admins"],
"propagate": False,
},
},
}
try:
from $PROJ.settings_local import *
except ImportError:
pass
EOF
echo "generating $PROJ/settings_dev.py..."
cat >$PROJ/settings_dev.py <<EOF
import sys
from $PROJ.settings import *
DEBUG = True
TEMPLATE_DEBUG = DEBUG
STATIC_URL = "/static-dev/"
TEMPLATE_LOADERS = [
"django.template.loaders.filesystem.Loader",
"django.template.loaders.app_directories.Loader",
]
INTERNAL_IPS = [
"127.0.0.1",
]
MIDDLEWARE_CLASSES += ["debug_toolbar.middleware.DebugToolbarMiddleware"]
INSTALLED_APPS += ["debug_toolbar"]
LOGGING["loggers"]["django"]["level"] = "DEBUG"
LOGGING["loggers"]["django.request"]["level"] = "DEBUG"
LOGGING["loggers"]["$PROJ"]["level"] = "DEBUG"
LOGGING["handlers"]["console"]["formatter"] = "verbose"
LOGGING["handlers"]["mail_admins"] = {"level": "DEBUG",
"class": "django.utils.log.NullHandler"}
try:
from $PROJ.settings_dev_local import *
except ImportError:
pass
EOF
echo "generating $PROJ/settings_local.py..."
cat >$PROJ/settings_local.py <<EOF
# i"m ignored by git so you can specify your secret settings :)
SECRET_KEY = "$(head -c 51 /dev/urandom | base64)"
EOF
echo "generating $PROJ/middleware.py..."
cat >$PROJ/middleware.py <<EOF
r"""
middleware
$(echo middleware | sed s/./~/g)
Django middleware definitions.
"""
from django.utils.cache import add_never_cache_headers
class NeverCache(object):
def process_response(self, request, response):
add_never_cache_headers(response)
return response
class XForwardedForMiddleware(object):
"""Replace \`\`REMOTE_ADDR\`\` with \`\`HTTP_X_FORWARDED_FOR\`\`
When reverse proxying from nginx, we receive a tcp connection from
localhost which isn"t the client"s real ip address. Normally
reverse proxies are configured to set the \`\`X-Forwarded-For\`\`
header which gives us the actual client ip.
"""
def process_request(self, request):
if "HTTP_X_FORWARDED_FOR" in request.META:
ip = request.META["HTTP_X_FORWARDED_FOR"]
# trim that goofy prefix when nginx uses hybrid ip4/ip6 sockets
if ip.startswith('::ffff:'):
ip = ip[len('::ffff:'):]
request.META["REMOTE_ADDR"] = ip
request.META["REMOTE_HOST"] = None
class CsrfCookieWhenLoggedIn(object):
"""Tell Django to set CSRF cookie on all pages when logged in
Normally Django only sets the CSRF cookie when you use the CSRF
protection template tag. Because we use Ajax for just about
everything, we need to ensure this cookie is always set once the
user logs in.
"""
def process_response(self, request, response):
if response.status_code == 200 and request.method == "GET":
if request.user.is_authenticated():
request.META["CSRF_COOKIE_USED"] = True
return response
EOF
echo "generating $PROJ/tests.py..."
cat >$PROJ/tests.py <<EOF
from django.test import TestCase
from django.core.urlresolvers import reverse
class BasicTest(TestCase):
fixtures = []
def setUp(self):
pass
def test_index(self):
url = reverse("index")
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
def test_notfound(self):
response = self.client.get("/euhcuehsrcoahucr/")
self.assertEqual(response.status_code, 404)
def test_error(self):
url = reverse("error")
self.assertRaises(AssertionError, lambda: self.client.get(url))
EOF
echo "generating $PROJ/admin.py..."
cat >$PROJ/admin.py <<EOF
r"""
admin
$(echo admin | sed s/./~/g)
Django admin gui customization
"""
# import reversion
from django.contrib import admin
from django.contrib.auth.models import User, Group
from django.contrib.auth.admin import UserAdmin, GroupAdmin
# from $PROJ import models as db
class AdminSite(admin.AdminSite):
"""Subclassed admin site (to avoid running code in global scope)"""
def __init__(self, *args, **kwargs):
admin.AdminSite.__init__(self, *args, **kwargs)
self.register(User, UserAdmin)
self.register(Group, GroupAdmin)
# self.register(db.Article, ArticleAdmin)
# class ArticleAdmin(reversion.VersionAdmin):
# """Version controlled blog entry manager for Django Admin"""
# list_display = ('title', 'author', 'published', 'is_published')
# list_filter = ('is_visible',)
# search_fields = ('title', 'content', 'author__username')
# prepopulated_fields = {"slug": ("title",)}
# history_latest_first = True
EOF
echo "generating $PROJ/urls.py..."
cat >$PROJ/urls.py <<EOF
r"""
urls
$(echo urls | sed s/./~/g)
HTTP request routing
"""
from django.conf import settings
from django.views.generic import TemplateView
from django.conf.urls.defaults import patterns, url, include
from django.views.decorators.http import require_GET, require_POST
from django.contrib.auth.urls import urlpatterns as auth_urlpatterns
from $PROJ.admin import AdminSite
adminsite = AdminSite(name="${PROJ}_admin")
urlpatterns = auth_urlpatterns + patterns("",
url(r"^$", TemplateView.as_view(template_name="$PROJ/index.html"), name="index"),
url(r'^about/$', TemplateView.as_view(template_name="$PROJ/about.html"), name="about"),
# url(r"^article/(?P<slug>[-_\d\w]+)/$", "$PROJ.views.article", name="article"),
url(r"^error/$", "$PROJ.views.error", name="error"),
url(r"^admin/", include(adminsite.urls)),
)
if settings.DEBUG:
urlpatterns += patterns("",
url(r"^media/(?P<path>.*)$", "django.views.static.serve",
{"document_root": settings.MEDIA_ROOT}),
)
EOF
echo "generating $PROJ/views.py..."
cat >$PROJ/views.py <<EOF
r"""
views
$(echo views | sed s/./~/g)
Dynamic web page functions
"""
# from django.conf import settings
# from django.template import RequestContext
# from django.shortcuts import render_to_response
# from $PROJ import models as db
def error(request):
"""A view that's designed to fail"""
assert False
EOF
echo "generating $PROJ/models.py..."
cat >$PROJ/models.py <<EOF
r"""
models
$(echo models | sed s/./~/g)
Database definition
"""
# from django.db import models
# from django.contrib.auth.models import User
# class Article(models.Model):
# """An example table for storing your blog entries"""
# author = models.ForeignKey(User, help_text="""
# The user who wrote this article.""")
# title = models.CharField(max_length=255, help_text="""
# A one-line title to describe article.""")
# slug = models.SlugField(unique=True, help_text="""
# A label for this article to appear in the url. DO NOT change
# this once the article has been published.""")
# published = models.DateTimeField(help_text="""
# When was article was published?""")
# content = models.TextField(blank=True, help_text="""
# The contents of the article""")
# is_published = models.BooleanField(default=False, help_text="""
# Should it be listed on the website and syndicated?""")
#
# def __unicode__(self):
# return "Article \"%s\" by %s" % (self.title, self.author)
#
# @models.permalink
# def get_absolute_url(self):
# return ('article', [self.slug])
EOF
echo "generating $PROJ/templates/404.html"
cat >$PROJ/templates/404.html <<EOF
{% extends "$PROJ/base.html" %}
{% block body %}
<h1>four oh four: brian not found</h1>
{% endblock body %}
EOF
echo "generating $PROJ/templates/500.html"
cat >$PROJ/templates/500.html <<EOF
<h1>500: Internal Server Catastrophe</h1>
EOF
echo "generating $PROJ/templates/$PROJ/base.html"
cat >$PROJ/templates/$PROJ/base.html <<EOF
<!DOCTYPE html>
<html>
<head>
{% load gravatar %}
<meta charset="utf-8" />
<title>{% block title %}$PROJ{% endblock title %}</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<link rel="shortcut icon" href="{{ STATIC_URL }}$PROJ/img/favicon.png" />
<meta name="description" content="{% block description %}$PROJ{% endblock description %}" />
<link rel="canonical" href="{% block canonical %}{{ request.path }}{% endblock canonical %}" />
{% if debug %}
<link href="{{ STATIC_URL }}$PROJ/css/$PROJ.less" rel="stylesheet" type="text/less" media="all" />
<script src="{{ STATIC_URL }}js/less.min.js"></script>
{% else %}
<link href="{{ STATIC_URL }}$PROJ/css/$PROJ.min.css" rel="stylesheet" type="text/css" media="all" />
{% endif %}
<script src="{{ STATIC_URL }}js/modernizr{% if not debug %}.min{% endif %}.js"></script>
{% block extra_head %}
{% endblock extra_head %}
</head>
<body class="design {% block body_class %}{% endblock %}">
{% block body %}
<nav class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="/">$PROJ</a>
<ul class="nav">
<li class="{% block nav_home_class %}{% endblock %}"><a href="/">Home</a></li>
<li class="{% block nav_about_class %}{% endblock %}"><a href="/about/">About</a></li>
</ul>
{% if user.is_authenticated %}
<ul class="nav pull-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
{% gravatar user 16 %} {{ user.username }}
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li><a class="userlink" href="{% url password_change %}">Change Password</a></li>
<li class="divider"></li>
<li><a class="userlink" href="{% url logout %}">Log Out</a></li>
</ul>
</li>
</ul>
{% else %}
<ul class="nav pull-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Log In <b class="caret"></b></a>
<ul class="dropdown-menu login">
<form action="{% url login %}" method="post">{% csrf_token %}
<label for="login-username">Username</label>
<input class="span2" type="text" name="username" id="login-username" placeholder="Username">
<label for="login-password">Passphrase</label>
<input class="span2" type="password" name="password" id="login-password" placeholder="Passphrase">
<button class="btn primary" type="submit">Sign in</button>
</form>
<small><a href="{% url password_reset %}">Forgot password</a></small>
</ul>
</li>
</ul>
{% endif %}
</div>
</div>
</nav>
<div class="container">
{% block content %}{% endblock content %}
</div> <!-- /container -->
{% endblock body %}
{% block scripts %}
{% if debug %}
<script src="{{ STATIC_URL }}js/jquery.js"></script>
<script src="{{ STATIC_URL }}bootstrap/js/bootstrap-transition.js"></script>
<script src="{{ STATIC_URL }}bootstrap/js/bootstrap-alert.js"></script>
<script src="{{ STATIC_URL }}bootstrap/js/bootstrap-modal.js"></script>
<script src="{{ STATIC_URL }}bootstrap/js/bootstrap-dropdown.js"></script>
<script src="{{ STATIC_URL }}bootstrap/js/bootstrap-scrollspy.js"></script>
<script src="{{ STATIC_URL }}bootstrap/js/bootstrap-tab.js"></script>
<script src="{{ STATIC_URL }}bootstrap/js/bootstrap-tooltip.js"></script>
<script src="{{ STATIC_URL }}bootstrap/js/bootstrap-popover.js"></script>
<script src="{{ STATIC_URL }}bootstrap/js/bootstrap-button.js"></script>
<script src="{{ STATIC_URL }}bootstrap/js/bootstrap-collapse.js"></script>
<script src="{{ STATIC_URL }}bootstrap/js/bootstrap-carousel.js"></script>
<script src="{{ STATIC_URL }}bootstrap/js/bootstrap-typeahead.js"></script>
<script src="{{ STATIC_URL }}js/coffee-script.min.js"></script>
<script src="{{ STATIC_URL }}$PROJ/js/$PROJ.coffee" type="text/coffeescript"></script>
{% else %}
<script src="{{ STATIC_URL }}js/jquery.min.js"></script>
<script src="{{ STATIC_URL }}js/bootstrap.min.js"></script>
<script src="{{ STATIC_URL }}$PROJ/js/$PROJ.min.js"></script>
{% endif %}
{% endblock scripts %}
</body>
</html>
EOF
echo "generating $PROJ/templates/$PROJ/index.html"
cat >$PROJ/templates/$PROJ/index.html <<EOF
{% extends "$PROJ/base.html" %}
{% block body_class %}index{% endblock %}
{% block nav_home_class %}active{% endblock %}
{% block title %}$PROJ &ndash; The Best Website{% endblock %}
{% block description %}A really awesome website generated by Django-Bone{% endblock %}
{% block extra_head %}
<!-- http://developers.facebook.com/tools/debug -->
<!-- <meta property="og:locale" content="en_US"/> -->
<!-- <meta property="og:title" content="Useful Tags for Facebook Links"/> -->
<!-- <meta property="og:url" content="http://www.baileyhouse.org/auction/"/> -->
<!-- <meta property="og:description" content="I let you control how this page will show up in a Facebook feed when people link to it"/> -->
<!-- <meta property="og:image" content="{{ STATIC_URL }}$PROJ/img/fb.png"/> -->
{% endblock extra_head %}
{% block content %}
<div class="content">
<header class="page-header">
<h1>$PROJ <small>Welcome to Space Radio</small></h1>
</header>
<div class="row">
<article class="span9">
<section>
<h1>article header h1</h1>
<p>The unholy memories and the witches follow, no one qᵫſtions why the damned call your name cunninger than the petty numbneſs, more frozen than witches in ſwirling duſt. they melt my wiſdom and cry out with all my terror.</p>
</section>
<section>
<h2>article section h2</h2>
<p>Deeper than a petty bitterneſs, no one cares why the ſhadows bleed, delivering me to ſwirling duſt. in the Hell my frenzy ſhall beg forgiveneſs. oh my blood! the love! they drip my heart and flail madly with all my numbneſs. in the the gates of hell my torment ſhall fall limply…</p>
</section>
<section>
<h2>article section h2</h2>
<p>The angry ſhadows and the hand of Heaven ſcour, delivering me to a void deader than damned in broken ground, cunninger than damned in death. in the nothingneſs my miſery ſhall beg forgiveneſs becauſe no one cares why the condemned cry out.</p>
</section>
<section>
<h3>article footer h3</h3>
<p>the ſickly ſhadows and the ſhadows ſurround, the dead hand of Heaven and the memories approach… OH MY SOUL! THE TERROR! moroſer than ſtroke of death in my doom and ſicklier than ſhadows in the path that ſhall deliver me to the witching hour.</p>
</section>
</article>
<aside class="span3">
<h3>aside</h3>
<p>Every burning dumpſter is a refuſal to be productive, a blow againſt the temporality of liberaliſm, a recognition of the ſingular teleology inherent in the articulation of multiplicities.</p>
</aside>
</div>
</div>
<footer>
<p>&copy; $(date +%Y) $AUTHOR</p>
</footer>
{% endblock content %}
EOF
echo "generating $PROJ/templates/$PROJ/about.html"
cat >$PROJ/templates/$PROJ/about.html <<EOF
{% extends "$PROJ/base.html" %}
{% block title %}About | {{ block.super }}{% endblock %}
{% block page_title %}About{% endblock %}
{% block body_class %}about{% endblock %}
{% block content %}
<div class="content">
<header class="page-header">
<h1>About</h1>
</header>
<div class="row">
<div class="span12">
<p>The unholy memories and the witches follow, no one qᵫſtions why the damned call your name cunninger than the petty numbneſs, more frozen than witches in ſwirling duſt. they melt my wiſdom and cry out with all my terror.</p>
<p>Deeper than a petty bitterneſs, no one cares why the ſhadows bleed, delivering me to ſwirling duſt. in the Hell my frenzy ſhall beg forgiveneſs. oh my blood! the love! they drip my heart and flail madly with all my numbneſs. in the the gates of hell my torment ſhall fall limply…</p>
</div>
</div>
</div>
{% endblock content %}
EOF
echo "generating $PROJ/static/$PROJ/js/$PROJ.coffee..."
cat >$PROJ/static/$PROJ/js/$PROJ.coffee <<EOF
$ ->
# disable default click behavior in login dropdown (bootstrap)
\$('.login form').click (ev) ->
ev.stopPropagation()
# Insert CSRF cookie in AJAX requests
\$(document).ajaxSend (event, xhr, settings) ->
getCookie = (name) ->
if document.cookie
for cookie in document.cookie.split ';'
if cookie[0..name.length] is name + "="
return decodeURIComponent cookie[name.length + 1...]
sameOrigin = (url) ->
host = document.location.host
protocol = document.location.protocol
sr_origin = '//' + host
origin = protocol + sr_origin
url is origin or url[..origin.length] is origin + '/' or
url is sr_origin or url[..sr_origin.length] is sr_origin + '/' or
not /^(\/\/|http:|https:).*/.test url
safeMethod = (method) ->
/^(GET|HEAD|OPTIONS|TRACE)\$/.test method
if not safeMethod settings.type and sameOrigin settings.url
xhr.setRequestHeader "X-CSRFToken", getCookie 'csrftoken'
EOF
echo "generating $PROJ/static/$PROJ/css/$PROJ.less..."
cat >$PROJ/static/$PROJ/css/$PROJ.less <<EOF
@import "../../bootstrap/less/bootstrap.less";
body.design {
background-color: #eee;
padding-top: 40px;
.login { padding: 1em; }
.login a { color: #08c; display: inline; padding: 0; }
.container > footer p { text-align: center; }
a.btn { color: #404040; text-shadow: none; }
.userlink img { vertical-align: middle; }
.content {
background-color: #fff;
padding: 20px;
margin: 0 -20px;
.border-radius(0 0 6px 6px);
.box-shadow(0 1px 2px rgba(0,0,0,.15));
}
.page-header {
background-color: #f5f5f5;
padding: 20px 20px 10px;
margin: -20px -20px 20px;
}
.topbar .btn {
border: 0;
}
}
EOF
echo "generating $PROJ/templates/$PROJ/form_fields.html"
cat >$PROJ/templates/$PROJ/form_fields.html <<EOF
{% for field in form %}
<div class="control-group {% if field.errors %}error{% endif %}">
<label class="control-label" for="id_{{ field.name }}">{{ field.label }}</label>
<div class="controls">
{{ field }}
{% if field.errors %}
<span class="help-inline">
{% for error in field.errors %}
{{ error }}
{% endfor %}
</span>
{% else %}
{% if field.help_text %}
<span class="help-inline">{{ field.help_text }}</span>
{% endif %}
{% endif %}
</div>
</div>
{% endfor %}
EOF
echo "generating $PROJ/templates/$PROJ/form_errors.html"
cat >$PROJ/templates/$PROJ/form_errors.html <<EOF
{% for error in form.non_field_errors %}
<div class="alert alert-error">{{ error }}</div>
{% endfor %}
EOF
echo "generating $PROJ/templates/registration/logged_out.html"
cat >$PROJ/templates/registration/logged_out.html <<EOF
{% extends "$PROJ/base.html" %}
{% load i18n %}
{% block title %}Change Password | {{ block.super }}{% endblock %}
{% block page_title %}Change Password{% endblock %}
{% block body_class %}password_change{% endblock %}
{% block content %}
<div class="content">
<header class="page-header">
<h1>User Portal</h1>
</header>
<div class="row">
<div class="span12">
<p>{% trans "Thanks for spending some quality time with the Web site today." %}</p>
<p><a href="{% url login %}">{% trans 'Log in again' %}</a></p>
</div>
</div>
</div>
{% endblock content %}
EOF
echo "generating $PROJ/templates/registration/login.html"
cat >$PROJ/templates/registration/login.html <<EOF
{% extends "$PROJ/base.html" %}
{% block title %}Log In | {{ block.super }}{% endblock %}
{% block page_title %}Log In{% endblock %}
{% block body_class %}login{% endblock %}
{% block content %}
<div class="content">
<header class="page-header">
<h1>User Portal</h1>
</header>
<div class="row">
<div class="span6">
<form id="login_form" action="." method="post">{% csrf_token %}
{% include "$PROJ/form_errors.html" %}
<fieldset>
<legend>Log In</legend>
{% include "$PROJ/form_fields.html" %}
<div>
<input type="submit" class="btn btn-primary" value="Submit">&nbsp;
<button type="reset" class="btn">Cancel</button>
</div>
</fieldset>
</form>
<p>
<a href="{% url password_reset %}">Forgot Password?</a>
</p>
</div>
</div>
</div>
{% endblock content %}
{% block js_init %}{{ block.super }}
\$("input").first().focus();
\$("form .error input").first().focus();
{% endblock js_init %}
EOF
echo "generating $PROJ/templates/registration/password_change_done.html"
cat >$PROJ/templates/registration/password_change_done.html <<EOF
{% extends "$PROJ/base.html" %}
{% load i18n %}
{% block title %}Password Change | {{ block.super }}{% endblock %}
{% block page_title %}Password Change{% endblock %}
{% block body_class %}password_change{% endblock %}
{% block content %}
<div class="content">
<header class="page-header">
<h1>User Portal</h1>
</header>
<div class="row">
<div class="span6">
<h2>{% trans 'Password change successful' %}</h2>
<p>{% trans 'Your password was changed.' %}</p>
</div>
</div>
</div>
{% endblock content %}
EOF
echo "generating $PROJ/templates/registration/password_change_form.html"
cat >$PROJ/templates/registration/password_change_form.html <<EOF
{% extends "$PROJ/base.html" %}
{% load i18n %}
{% block title %}Change Password | {{ block.super }}{% endblock %}
{% block page_title %}Change Password{% endblock %}
{% block body_class %}password_change{% endblock %}
{% block content %}
<div class="content">
<header class="page-header">
<h1>User Portal</h1>
</header>
<div class="row">
<div class="span8">
<form class="form-horizontal" action="." method="post">{% csrf_token %}
{% include "$PROJ/form_errors.html" %}
<fieldset>
<legend>Change Password</legend>
{% include "$PROJ/form_fields.html" %}
<div class="form-actions">
<input type="submit" class="btn btn-primary" value="Submit">&nbsp;
<button type="reset" class="btn">Cancel</button>
</div>
</fieldset>
</form>
</div>
<div class="span4">
<h2>Help</h2>
<p>{% trans "Please enter your old password, for security's sake, and then enter your new password twice so we can verify you typed it in correctly." %}</p>
</div>
</div>
</div>
{% endblock content %}
{% block js_init %}{{ block.super }}
\$("#id_old_password").first().focus();
\$("form .error input").first().focus();
{% endblock js_init %}
EOF
echo "generating $PROJ/templates/registration/password_reset_complete.html"
cat >$PROJ/templates/registration/password_reset_complete.html <<EOF
{% extends "$PROJ/base.html" %}
{% load i18n %}
{% block title %}Password Reset | {{ block.super }}{% endblock %}
{% block page_title %}Password Reset{% endblock %}
{% block body_class %}password_reset{% endblock %}
{% block content %}
<div class="content">
<header class="page-header">
<h1>User Portal</h1>
</header>
<div class="row">
<div class="span6">
<h2>{% trans 'Password reset complete' %}</h2>
<p>{% trans "Your password has been set. You may go ahead and log in now." %}</p>
<p><a class="btn" href="{{ login_url }}">{% trans 'Log in' %}</a></p>
</div>
</div>
</div>
{% endblock content %}
EOF
echo "generating $PROJ/templates/registration/password_reset_confirm.html"
cat >$PROJ/templates/registration/password_reset_confirm.html <<EOF
{% extends "$PROJ/base.html" %}
{% load i18n %}
{% block title %}Password Reset | {{ block.super }}{% endblock %}
{% block page_title %}Password Reset{% endblock %}
{% block body_class %}password_reset{% endblock %}
{% block content %}
<div class="content">
<header class="page-header">
<h1>User Portal</h1>
</header>
<div class="row">
<div class="span6">
{% if validlink %}
<h2>{% trans 'Enter new password' %}</h2>
<form action="." method="post">{% csrf_token %}
{% include "$PROJ/form_errors.html" %}
<fieldset>
<p>{% trans "Please enter your new password twice so we can verify you typed it in correctly." %}</p>
{% include "$PROJ/form_fields.html" %}
<div>
<input type="submit" class="btn btn-primary" value="Submit">&nbsp;
<button type="reset" class="btn">Cancel</button>
</div>
</fieldset>
</form>
{% else %}
<h2>{% trans 'Password reset unsuccessful' %}</h2>
<p>{% trans "The password reset link was invalid, possibly because it has already been used. Please request a new password reset." %}</p>
{% endif %}
</div>
</div>
</div>
{% endblock content %}
{% block js_init %}{{ block.super }}
\$("id_password").focus();
{% endblock js_init %}
EOF
echo "generating $PROJ/templates/registration/password_reset_done.html"
cat >$PROJ/templates/registration/password_reset_done.html <<EOF
{% extends "$PROJ/base.html" %}
{% load i18n %}
{% block title %}Password Reset | {{ block.super }}{% endblock %}
{% block page_title %}Password Reset{% endblock %}
{% block body_class %}password_reset{% endblock %}
{% block content %}
<div class="content">
<header class="page-header">
<h1>User Portal</h1>
</header>
<div class="row">
<div class="span6">
<h2>{% trans 'Password Reset' %}</h2>
<p>{% trans "We've e-mailed you instructions for setting your password to the e-mail address you submitted. You should be receiving it shortly." %}</p>
</div>
</div>
</div>
{% endblock content %}
EOF
echo "generating $PROJ/templates/registration/password_reset_email.html"
cat >$PROJ/templates/registration/password_reset_email.html <<EOF
{% load i18n %}{% load url from future %}{% autoescape off %}
{% blocktrans %}You're receiving this e-mail because you requested a password reset for your user account at {{ site_name }}.{% endblocktrans %}
{% trans "Please go to the following page and choose a new password:" %}
{% block reset_link %}
{{ protocol }}://{{ domain }}{% url 'django.contrib.auth.views.password_reset_confirm' uidb36=uid token=token %}
{% endblock %}
{% trans "Your username, in case you've forgotten:" %} {{ user.username }}
{% trans "Thanks for using our site!" %}
{% blocktrans %}The {{ site_name }} team{% endblocktrans %}
{% endautoescape %}
EOF
echo "generating $PROJ/templates/registration/password_reset_form.html"
cat >$PROJ/templates/registration/password_reset_form.html <<EOF
{% extends "$PROJ/base.html" %}
{% block title %}Password Reset | {{ block.super }}{% endblock %}
{% block page_title %}Password Reset{% endblock %}
{% block body_class %}password_reset{% endblock %}
{% block content %}
<div class="content">
<header class="page-header">
<h1>User Portal</h1>
</header>
<div class="row">
<div class="span6">
<form action="." method="post">{% csrf_token %}
{% include "$PROJ/form_errors.html" %}
<fieldset>
<p>Forgotten your password? Enter your e-mail address below, and we'll e-mail instructions for setting a new one.</p>
{% include "$PROJ/form_fields.html" %}
<div>
<input type="submit" class="btn btn-primary" value="Submit">&nbsp;
<button type="reset" class="btn">Cancel</button>
</div>
</fieldset>
</form>
</div>
</div>
</div>
{% endblock content %}
{% block js_init %}{{ block.super }}
\$("id_email").focus();
{% endblock js_init %}
EOF
echo "generating conf/nginx/nginx.conf..."
cat >conf/nginx/nginx.conf <<EOF
# -*-conf-*-
user www-data;
worker_processes 2;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
# multi_accept on;
}
http {
include /etc/nginx/mime.types;
access_log /var/log/nginx/access.log;
sendfile on;
keepalive_timeout 65;
tcp_nodelay on;
charset utf-8;
ssl_session_cache shared:SSL:2m;
ssl_session_timeout 10m;
limit_req_zone $binary_remote_addr zone=one:10m rate=60r/m;
gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
gzip_types text/html text/css text/xml application/x-javascript;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
EOF
echo "generating conf/nginx/$PROJ.conf..."
cat >conf/nginx/$PROJ.conf <<EOF
# -*-conf-*-
# /etc/nginx/sites-available/$PROJ.conf
#
# To Enable:
#
# sudo ln -sf ../sites-available/$PROJ.conf /etc/nginx/sites-enabled
# sudo /etc/init.d/nginx reload
#
upstream $PROJ {
server 127.0.0.1:7000;
}
server {
listen [::]:80 default; # listens on both IPv4 and IPv6
server_name $PROJ.com www.$PROJ.com;
server_name_in_redirect on;
access_log /var/log/$PROJ.com.log;
error_log /var/log/$PROJ.com.error.log error;
# # also listen for https requests
# listen [::]:443 default ssl;
# ssl_prefer_server_ciphers on;
# ssl_protocols SSLv3;
# ssl_ciphers HIGH:!ADH:!MD5;
# ssl_certificate /etc/ssl/$PROJ.com/crt-cabundle;
# ssl_certificate_key /etc/ssl/$PROJ.com/key;
# # get rid of www.
# if (\$host !~* ^$PROJ\.com\$) {
# rewrite ^(.*)\$ http://$PROJ.com\$1 redirect;
# }
location ~ /\. { deny all; }
location = /favicon.ico { access_log off; return 404; }
location = /robots.txt { access_log off; return 404; }
location = /sitemap.xml { access_log off; return 404; }
location /static/ {
root ${VIRTUAL_ENV};
expires 1y;
add_header Cache-Control public;
# autoindex on;
# autoindex_localtime on;
}
location / {
proxy_redirect off;
proxy_pass http://$PROJ;
proxy_set_header X-Forwarded-For \$remote_addr;
proxy_set_header X-Forwarded-Host \$PROJ.com;
proxy_set_header X-Forwarded-Port \$server_port;
proxy_connect_timeout 5000ms;
limit_req zone=one burst=10;
}
}
EOF
echo "generating conf/init.d/$PROJ..."
cat >conf/init.d/$PROJ <<EOF
#! /bin/sh
### BEGIN INIT INFO
# Provides: $PROJ
# Required-Start: \$local_fs \$remote_fs \$network \$syslog
# Required-Stop: \$local_fs \$remote_fs \$network \$syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start $PROJ gunicorn daemon
# Description: Start $PROJ gunicorn daemon
### END INIT INFO
# Edit /etc/default/$PROJ to change these.
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=$PROJ
DESC=$PROJ
VIRTUAL_ENV=${VIRTUAL_ENV}
DAEMON=\${VIRTUAL_ENV}/bin/gunicorn_django
PIDFILE=\${VIRTUAL_ENV}/run/$PROJ.pid
SETTINGS=\${VIRTUAL_ENV}/$PROJ/settings.py
RUNAS=$USER
WORKERS=5
BIND=127.0.0.1:7000
test -r /etc/default/$PROJ && . /etc/default/$PROJ
ARGS="--daemon --bind=\$BIND --workers=\$WORKERS --max-requests=1000 --pid=\$PIDFILE \$SETTINGS"
set -e
. /lib/lsb/init-functions
case "\$1" in
start)
echo -n "Starting \$DESC: "
start-stop-daemon --start --pidfile \$PIDFILE --exec \$DAEMON --chuid \$RUNAS -- \$ARGS
echo "\$NAME."
;;
stop)
echo -n "Stopping \$DESC: "
start-stop-daemon --stop --pidfile \$PIDFILE
echo "\$NAME."
rm -f \$PIDFILE
;;
restart|force-reload)
echo -n "Restarting \$DESC: "
start-stop-daemon --stop --pidfile \$PIDFILE
rm -f \$PIDFILE
sleep 1
start-stop-daemon --start --pidfile \$PIDFILE --exec \$DAEMON --chuid \$RUNAS -- \$ARGS
echo "\$NAME."
;;
reload)
echo -n "Reloading \$DESC: "
start-stop-daemon --stop --signal HUP --pidfile \$PIDFILE
echo "\$NAME."
;;
status)
status_of_proc \$DAEMON \$NAME
;;
*)
N=/etc/init.d/\$NAME
echo "Usage: \$N {start|stop|reload|restart|force-reload|status}" >&2
exit 1
;;
esac
exit 0
EOF
echo "generating $PROJ/management/__init__.py..."
touch $PROJ/management/__init__.py
echo "generating $PROJ/management/commands/__init__.py..."
touch $PROJ/management/commands/__init__.py
echo "generating $PROJ/management/commands/example.py..."
cat >$PROJ/management/commands/example.py <<EOF
r"""
cmd.example
$(echo cmd.example | sed s/./~/g)
Example manage.py command. Prints out whatever arguments you pass.
"""
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
class Command(BaseCommand):
args = 'WORD ...'
help = __doc__
option_list = BaseCommand.option_list + (
make_option(
'--twice', action='store_true', dest='twice',
default=False, help="Print output twice"),
make_option(
'--indent', type='int', dest='indent',
default=4, help="How many spaces to indent"),
)
def handle(self, *args, **options):
if not args:
raise CommandError('Please specify some args!')
output = (' ' * options.indent) + ' '.join(args)
print output
if options.twice:
print output
EOF
echo "generating doc/conf.py..."
cat >doc/conf.py <<EOF
# -*- coding: utf-8 -*-
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
if not os.environ.get("DJANGO_SETTINGS_MODULE"):
os.environ["DJANGO_SETTINGS_MODULE"] = "$PROJ.settings"
# -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'$PROJ'
copyright = u'$(date +%Y), $AUTHOR'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.1'
# The full version, including alpha/beta/rc tags.
release = '0.1'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
# The reST default role (used for this markup: 'text') to use for all documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'default'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = '${PROJ}doc'
# -- Options for LaTeX output --------------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', '$PROJ.tex', u'$PROJ Documentation',
u'$AUTHOR', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# -- Options for manual page output --------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', '$PROJ', u'$PROJ Documentation',
[u'$AUTHOR'], 1)
]
# If true, show URL addresses after external links.
#man_show_urls = False
# -- Options for Texinfo output ------------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', '$PROJ', u'$PROJ Documentation',
u'$AUTHOR', '$PROJ', 'One line description of project.',
'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.
#texinfo_appendices = []
# If false, no module index is generated.
#texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
EOF
echo "generating doc/index.rst..."
cat >doc/index.rst <<EOF
.. include:: ../README.rst
Modules
=======
.. automodule:: $PROJ.models
:members:
.. automodule:: $PROJ.views
:members:
.. automodule:: $PROJ.admin
:members:
.. automodule:: $PROJ.urls
:members:
.. automodule:: $PROJ.settings
:members:
.. automodule:: $PROJ.middleware
:members:
.. automodule:: $PROJ.management.commands.example
:members:
EOF
echo "generating doc/Makefile..."
cat >doc/Makefile <<EOF
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d \$(BUILDDIR)/doctrees \$(PAPEROPT_\$(PAPER)) \$(SPHINXOPTS) .
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
-rm -rf \$(BUILDDIR)/*
html:
\$(SPHINXBUILD) -b html \$(ALLSPHINXOPTS) \$(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in \$(BUILDDIR)/html."
dirhtml:
\$(SPHINXBUILD) -b dirhtml \$(ALLSPHINXOPTS) \$(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in \$(BUILDDIR)/dirhtml."
singlehtml:
\$(SPHINXBUILD) -b singlehtml \$(ALLSPHINXOPTS) \$(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in \$(BUILDDIR)/singlehtml."
pickle:
\$(SPHINXBUILD) -b pickle \$(ALLSPHINXOPTS) \$(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
\$(SPHINXBUILD) -b json \$(ALLSPHINXOPTS) \$(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
\$(SPHINXBUILD) -b htmlhelp \$(ALLSPHINXOPTS) \$(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \\
".hhp project file in \$(BUILDDIR)/htmlhelp."
qthelp:
\$(SPHINXBUILD) -b qthelp \$(ALLSPHINXOPTS) \$(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \\
".qhcp project file in \$(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator \$(BUILDDIR)/qthelp/artsigs.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile \$(BUILDDIR)/qthelp/artsigs.qhc"
devhelp:
\$(SPHINXBUILD) -b devhelp \$(ALLSPHINXOPTS) \$(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p \$\$HOME/.local/share/devhelp/artsigs"
@echo "# ln -s \$(BUILDDIR)/devhelp \$\$HOME/.local/share/devhelp/artsigs"
@echo "# devhelp"
epub:
\$(SPHINXBUILD) -b epub \$(ALLSPHINXOPTS) \$(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in \$(BUILDDIR)/epub."
latex:
\$(SPHINXBUILD) -b latex \$(ALLSPHINXOPTS) \$(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in \$(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \\
"(use \`make latexpdf' here to do that automatically)."
latexpdf:
\$(SPHINXBUILD) -b latex \$(ALLSPHINXOPTS) \$(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
make -C \$(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in \$(BUILDDIR)/latex."
text:
\$(SPHINXBUILD) -b text \$(ALLSPHINXOPTS) \$(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in \$(BUILDDIR)/text."
man:
\$(SPHINXBUILD) -b man \$(ALLSPHINXOPTS) \$(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in \$(BUILDDIR)/man."
changes:
\$(SPHINXBUILD) -b changes \$(ALLSPHINXOPTS) \$(BUILDDIR)/changes
@echo
@echo "The overview file is in \$(BUILDDIR)/changes."
linkcheck:
\$(SPHINXBUILD) -b linkcheck \$(ALLSPHINXOPTS) \$(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \\
"or in \$(BUILDDIR)/linkcheck/output.txt."
doctest:
\$(SPHINXBUILD) -b doctest \$(ALLSPHINXOPTS) \$(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \\
"results in \$(BUILDDIR)/doctest/output.txt."
EOF
easy_install pip || exit 1
# ## BEGIN TEMPORARY
# # install dev django until 1.4 is released
# # pip download cache doesn't work when installing from a repo :(
# mkdir -p $PIP_DOWNLOAD_CACHE
# pushd $PIP_DOWNLOAD_CACHE
# if [[ -d $PIP_DOWNLOAD_CACHE/django ]]; then
# cd django
# git pull || exit 1
# else
# git clone git://github.com/django/django.git django || exit 1
# fi
# popd
# git clone $PIP_DOWNLOAD_CACHE/django ../django || exit 1
# pip install -e ../django || exit 1
# ## END TEMPORARY
pip install Django sphinx gunicorn pyflakes pep8 || exit 1
pip install -e $(pwd) || exit 1
$PROJ-dev collectstatic --noinput || exit 1
$PROJ-dev syncdb || exit 1
$PROJ-dev migrate || exit 1
make -C doc html
git init
git add .
git commit -m "django-bone initial import" \
--author="Justine Tunney <jtunney@lobstertech.com>"
cat <<EOF
----------------------------------------------------------------------
All Done!
To get started you should run:
cd $PROJ/$PROJ
source ../bin/activate
make dev && $PROJ-dev runserver
For further instructions:
firefox file://${VIRTUAL_ENV}/$PROJ/doc/_build/html/index.html
EOF
Jump to Line
Something went wrong with that request. Please try again.