├── test_dir
├── 404.html
└── 500.html
├── prodready
├── __init__.py
├── models.py
├── management
│ ├── __init__.py
│ └── commands
│ │ ├── __init__.py
│ │ └── is_it_ready.py
├── views.py
└── tests.py
├── MANIFEST.in
├── .gitignore
├── .travis.yml
├── CONTRIBUTORS.txt
├── README.rst
├── LICENSE.txt
├── runtests.py
├── docs
├── index.rst
├── Makefile
└── conf.py
└── setup.py
/test_dir/404.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/test_dir/500.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/prodready/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/prodready/models.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/MANIFEST.in:
--------------------------------------------------------------------------------
1 | include *.rst
2 |
--------------------------------------------------------------------------------
/prodready/management/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/prodready/management/commands/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/prodready/views.py:
--------------------------------------------------------------------------------
1 | # Create your views here.
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.pyc
2 | build/*
3 | *~
4 | *.swp
5 | dist/*
6 | django_production_ready.egg-info
7 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: python
2 | python:
3 | - "2.7"
4 | install:
5 | - "pip install pyflakes"
6 | script:
7 | - "pyflakes ."
--------------------------------------------------------------------------------
/CONTRIBUTORS.txt:
--------------------------------------------------------------------------------
1 | Thanks to all the contributors who helped improve the project.
2 |
3 | List of contributors arranged in alphabetical order:
4 | * Kailash K
5 | * Shabda Raaj
6 |
--------------------------------------------------------------------------------
/README.rst:
--------------------------------------------------------------------------------
1 | ------------------------
2 | Django Production Ready
3 | ------------------------
4 |
5 | A simple app with a single management command that checks if your project is
6 | production ready.
7 |
8 | Install
9 | --------
10 |
11 | * If you use pip_::
12 |
13 | $ pip install django-production-ready
14 |
15 | or
16 |
17 | * Checkout the source code from github_ and::
18 |
19 | $ python setup.py install
20 |
21 | * Add the app to your `INSTALLED_APPS` in the `settings.py`.
22 |
23 | INSTALLED_APPS = (
24 | ...
25 | prodready,
26 | ...
27 | )
28 |
29 | Usage
30 | ------
31 |
32 | Run the management command to run the tests:
33 |
34 | $ python manage.py is_it_ready
35 |
36 | Running tests
37 | -------------
38 |
39 | $ python runtests.py
40 |
41 | .. _pip: http://www.pip-installer.org/en/latest/
42 | .. _github: https://github.com/agiliq/django-production-ready
43 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2011, Agiliq Solutions
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5 |
6 | Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8 | Neither the name of the Agiliq Solutions nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10 |
--------------------------------------------------------------------------------
/runtests.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | import sys
4 | import os
5 | from optparse import OptionParser
6 |
7 | from django.conf import settings
8 |
9 | # For convenience configure settings if they are not pre-configured or if we
10 | # haven't been provided settings to use by environment variable.
11 | if not settings.configured and not os.environ.get('DJANGO_SETTINGS_MODULE'):
12 | settings.configure(
13 | DATABASES={
14 | 'default': {
15 | 'ENGINE': 'django.db.backends.sqlite3',
16 | }
17 | },
18 | INSTALLED_APPS=[
19 | 'prodready',
20 | ],
21 | )
22 |
23 | # Setup Django 1.7+ (AppRegistryNotReady).
24 | import django
25 | if hasattr(django, 'setup'):
26 | django.setup()
27 |
28 | from django.test.simple import DjangoTestSuiteRunner
29 |
30 |
31 | def runtests(*test_args, **kwargs):
32 | if not test_args:
33 | test_args = ['prodready']
34 | test_runner = DjangoTestSuiteRunner(
35 | verbosity=kwargs.get('verbosity', 1),
36 | interactive=kwargs.get('interactive', False),
37 | failfast=kwargs.get('failfast'))
38 | failures = test_runner.run_tests(test_args)
39 | sys.exit(failures)
40 |
41 | if __name__ == '__main__':
42 | parser = OptionParser()
43 | parser.add_option('--failfast', action='store_true', default=False, dest='failfast')
44 | (options, args) = parser.parse_args()
45 | runtests(failfast=options.failfast, *args)
46 |
--------------------------------------------------------------------------------
/docs/index.rst:
--------------------------------------------------------------------------------
1 | .. django-production-ready documentation master file, created by
2 | sphinx-quickstart on Sat Sep 5 18:34:15 2015.
3 | You can adapt this file completely to your liking, but it should at least
4 | contain the root `toctree` directive.
5 |
6 | Welcome to django-production-ready's documentation!
7 | ===================================================
8 |
9 | django-production-ready is a library to check if your project is production ready or not. eg: If settings.DEBUG is True, then your project is not production ready.
10 |
11 | This library is meant to make **minimal** set of checks before you deploy to production. Passing the checks means that your project **may be** production ready, but failing almost certainly means the project **is not** production ready.
12 |
13 | Installation
14 | ------------
15 |
16 | Install the app
17 |
18 | pip install django-production-ready
19 |
20 | Add app to settings.INSTALLED_APPS
21 |
22 | INSTALLED_APPS += ('prodready',)
23 |
24 |
25 | Basic usage
26 | -----------
27 |
28 | python manage.py is_it_ready
29 |
30 |
31 | Checks
32 | ------
33 |
34 | This librarys checks following things.
35 |
36 | * settings.DEBUG must be False
37 | * settings.TEMPLATE_DEBUG must be False
38 | * settings.DEBUG_PROPAGATE_EXCEPTIONS must be False
39 | * settings.ADMINS and settings.MANAGERS must not be empty
40 | * settings.EMAIL_HOST_USER must not be empty string
41 | * settings.SERVER_EMAIL and settings.DEFAULT_FROM_EMAIL must be changed from Django provided default values.
42 | * 404.html and 500.html must be configured properly
43 | * There must not be any *print* statement in the project
44 | * There must not be any *pdb* or *ipdb* statement in the project
45 |
46 | In case of any failed check, management command **is_it_ready** will show a log of failed checks. In such case you should consider your project not ready for production.
47 |
48 | Output
49 | ------
50 |
51 | If all checks pass, you would see::
52 |
53 | --------------------
54 | Production ready: Yes
55 | --------------------
56 |
57 | If any check fails, you would see log of failed checks. Assuming settings.DEBUG is True, then you would see something like::
58 |
59 | --------------------
60 | Production ready: No
61 | --------------------
62 | Possible errors:
63 | * Set DEBUG to False
64 |
65 |
66 | .. toctree::
67 | :maxdepth: 2
68 |
69 | Indices and tables
70 | ==================
71 |
72 | * :ref:`search`
73 |
--------------------------------------------------------------------------------
/prodready/tests.py:
--------------------------------------------------------------------------------
1 | import os
2 | from django.test import TestCase
3 |
4 | from prodready.management.commands.is_it_ready import Validations
5 |
6 |
7 | class ValidationsTest(TestCase):
8 |
9 | def run_validations(self, method_name):
10 | validations = Validations()
11 | messages = getattr(validations, method_name)()
12 | return messages
13 |
14 | def test_debug(self):
15 | """
16 | Tests that `messages` is populated when settings.DEBUG is True
17 | """
18 | with self.settings(DEBUG=True):
19 | messages = self.run_validations('check_debug_values')
20 | self.assertIn('Set DEBUG to False', messages)
21 |
22 | with self.settings(DEBUG=False):
23 | messages = self.run_validations('check_debug_values')
24 | self.assertNotIn('Set DEBUG to False', messages)
25 |
26 | def test_contacts(self):
27 | """
28 | Tests that `messages` is populated when settings.ADMINS are empty
29 | """
30 | messages = self.run_validations('check_contacts')
31 | self.assertIn('Enter valid email address in ADMINS section', messages)
32 |
33 | with self.settings(ADMINS=('test@mail.com',)):
34 | messages = self.run_validations('check_contacts')
35 | self.assertNotIn('Enter valid email address in ADMINS section', messages)
36 |
37 | messages = self.run_validations('check_contacts')
38 | self.assertIn('Enter valid email address in MANAGERS section', messages)
39 |
40 | with self.settings(MANAGERS=('test@mail.com',)):
41 | messages = self.run_validations('check_contacts')
42 | self.assertNotIn('Enter valid email address in MANAGERS section', messages)
43 |
44 | def test_email(self):
45 | """
46 | Tests that `messages` is populated when settings.EMAILS are default
47 | """
48 | messages = self.run_validations('check_email')
49 | self.assertIn('Setup E-mail host', messages)
50 |
51 | with self.settings(EMAIL_HOST_USER='test'):
52 | messages = self.run_validations('check_email')
53 | self.assertNotIn('Setup E-mail host', messages)
54 |
55 | messages = self.run_validations('check_email')
56 | self.assertIn('Set a valid email for SERVER_EMAIL',messages)
57 |
58 | with self.settings(SERVER_EMAIL='test@localhost'):
59 | messages = self.run_validations('check_email')
60 | self.assertNotIn('Set a valid email for SERVER_EMAIL',messages)
61 |
62 | messages = self.run_validations('check_email')
63 | self.assertIn('Set a valid email for DEFAULT_FROM_EMAIL',messages)
64 |
65 | with self.settings(DEFAULT_FROM_EMAIL='test@localhost'):
66 | messages = self.run_validations('check_email')
67 | self.assertNotIn('Set a valid email for DEFAULT_FROM_EMAIL',messages)
68 |
69 | def test_default_templates(self):
70 | """
71 | Tests that `messages` is populated when DEFAULT_TEMPLATES does not exist
72 | """
73 | messages = self.run_validations('check_default_templates')
74 | self.assertIn('Template 404.html does not exist', messages)
75 | self.assertIn('Template 500.html does not exist', messages)
76 |
77 | with self.settings(TEMPLATE_DIRS = (os.path.abspath('test_dir'),)):
78 | messages = self.run_validations('check_default_templates')
79 | self.assertNotIn('Template 404.html does not exist', messages)
80 | self.assertNotIn('Template 500.html does not exist', messages)
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | VERSION = (0, 1, 1, 'f', 0) # following PEP 386
2 | DEV_N = None
3 |
4 | import os
5 | import sys
6 | from fnmatch import fnmatchcase
7 | from distutils.util import convert_path
8 | from setuptools import setup, find_packages
9 |
10 | def read(fname):
11 | return open(os.path.join(os.path.dirname(__file__), fname)).read()
12 |
13 | # Provided as an attribute, so you can append to these instead
14 | # of replicating them:
15 | standard_exclude = ('*.py', '*.pyc', '*$py.class', '*~', '.*', '*.bak')
16 | standard_exclude_directories = ('.*', 'CVS', '_darcs', './build',
17 | './dist', 'EGG-INFO', '*.egg-info')
18 |
19 | def get_version():
20 | version = "%s.%s" % (VERSION[0], VERSION[1])
21 | if VERSION[2]:
22 | version = "%s.%s" % (version, VERSION[2])
23 | if VERSION[3] != "f":
24 | version = "%s%s%s" % (version, VERSION[3], VERSION[4])
25 | if DEV_N:
26 | version = "%s.dev%s" % (version, DEV_N)
27 | return version
28 |
29 | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
30 | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
31 | # Note: you may want to copy this into your setup.py file verbatim, as
32 | # you can't import this from another package, when you don't know if
33 | # that package is installed yet.
34 | def find_package_data(
35 | where='.', package='',
36 | exclude=standard_exclude,
37 | exclude_directories=standard_exclude_directories,
38 | only_in_packages=True,
39 | show_ignored=False):
40 | """
41 | Return a dictionary suitable for use in ``package_data``
42 | in a distutils ``setup.py`` file.
43 |
44 | The dictionary looks like::
45 |
46 | {'package': [files]}
47 |
48 | Where ``files`` is a list of all the files in that package that
49 | don't match anything in ``exclude``.
50 |
51 | If ``only_in_packages`` is true, then top-level directories that
52 | are not packages won't be included (but directories under packages
53 | will).
54 |
55 | Directories matching any pattern in ``exclude_directories`` will
56 | be ignored; by default directories with leading ``.``, ``CVS``,
57 | and ``_darcs`` will be ignored.
58 |
59 | If ``show_ignored`` is true, then all the files that aren't
60 | included in package data are shown on stderr (for debugging
61 | purposes).
62 |
63 | Note patterns use wildcards, or can be exact paths (including
64 | leading ``./``), and all searching is case-insensitive.
65 | """
66 |
67 | out = {}
68 | stack = [(convert_path(where), '', package, only_in_packages)]
69 | while stack:
70 | where, prefix, package, only_in_packages = stack.pop(0)
71 | for name in os.listdir(where):
72 | fn = os.path.join(where, name)
73 | if os.path.isdir(fn):
74 | bad_name = False
75 | for pattern in exclude_directories:
76 | if (fnmatchcase(name, pattern)
77 | or fn.lower() == pattern.lower()):
78 | bad_name = True
79 | if show_ignored:
80 | print >> sys.stderr, (
81 | "Directory %s ignored by pattern %s"
82 | % (fn, pattern))
83 | break
84 | if bad_name:
85 | continue
86 | if (os.path.isfile(os.path.join(fn, '__init__.py'))
87 | and not prefix):
88 | if not package:
89 | new_package = name
90 | else:
91 | new_package = package + '.' + name
92 | stack.append((fn, '', new_package, False))
93 | else:
94 | stack.append((fn, prefix + name + '/', package, only_in_packages))
95 | elif package or not only_in_packages:
96 | # is a file
97 | bad_name = False
98 | for pattern in exclude:
99 | if (fnmatchcase(name, pattern)
100 | or fn.lower() == pattern.lower()):
101 | bad_name = True
102 | if show_ignored:
103 | print >> sys.stderr, (
104 | "File %s ignored by pattern %s"
105 | % (fn, pattern))
106 | break
107 | if bad_name:
108 | continue
109 | out.setdefault(package, []).append(prefix+name)
110 | return out
111 |
112 | setup(
113 | name="django-production-ready",
114 | version=get_version(),
115 | description="A Django app that runs simple tests to check if your app is production ready.",
116 | long_description=read("README.rst"),
117 | author="Agiliq Solutions",
118 | author_email="hello@agiliq.com",
119 | license="BSD",
120 | url="http://github.com/agiliq/django-production-ready",
121 | packages=find_packages(),
122 | package_data=find_package_data("prodready", only_in_packages=False),
123 | classifiers=[
124 | "Development Status :: 3 - Alpha",
125 | "Environment :: Web Environment",
126 | "Intended Audience :: Developers",
127 | "License :: OSI Approved :: BSD License",
128 | "Operating System :: OS Independent",
129 | "Programming Language :: Python",
130 | "Framework :: Django",
131 | ],
132 | zip_safe=False,
133 | tests_require=["Django"],
134 | )
135 |
--------------------------------------------------------------------------------
/prodready/management/commands/is_it_ready.py:
--------------------------------------------------------------------------------
1 | from django.core.management.base import BaseCommand
2 | from django.conf import settings
3 | from django.template.loader import find_template
4 | from django.template import TemplateDoesNotExist
5 |
6 | import inspect
7 |
8 |
9 | class Command(BaseCommand):
10 | help = ('Validates the configuration settings against production '
11 | 'compliance and prints if any invalid settings are found')
12 |
13 | def write_result(self, messages):
14 | print (
15 | '%(border)s\n'
16 | 'Production ready: %(status)s\n'
17 | '%(border)s') % {'border': '-' * 20,
18 | 'status': 'No' if messages else 'Yes'}
19 | if messages:
20 | print 'Possible errors:'
21 | for message in messages:
22 | print ' *', message
23 |
24 | def handle(self, *args, **options):
25 | messages = Validations().run(options)
26 | self.write_result(messages)
27 | if messages:
28 | exit(1)
29 |
30 |
31 | class Validations(object):
32 | '''Runs validations against default django settings
33 | and returns helpful messages if any errors are found'''
34 |
35 | def has_template(self, name, location=[]):
36 | try:
37 | find_template(name, location)
38 | except TemplateDoesNotExist:
39 | return False
40 | else:
41 | return True
42 |
43 | def check_debug_values(self):
44 | messages = []
45 | if settings.DEBUG:
46 | messages.append('Set DEBUG to False')
47 |
48 | if settings.TEMPLATE_DEBUG:
49 | messages.append('Set TEMPLATE_DEBUG to False')
50 |
51 | if settings.DEBUG_PROPAGATE_EXCEPTIONS:
52 | messages.append('Set DEBUG_PROPAGATE_EXCEPTIONS to False')
53 |
54 | return messages
55 |
56 | def check_contacts(self):
57 | messages = []
58 | message_template = 'Enter valid email address in %s section'
59 | if not settings.ADMINS:
60 | messages.append(message_template % 'ADMINS')
61 |
62 | if not settings.MANAGERS:
63 | messages.append(message_template % 'MANAGERS')
64 |
65 | return messages
66 |
67 | def check_email(self):
68 | messages = []
69 |
70 | if not settings.EMAIL_HOST_USER:
71 | messages.append('Setup E-mail host')
72 |
73 | if settings.SERVER_EMAIL == 'root@localhost':
74 | messages.append('Set a valid email for SERVER_EMAIL')
75 |
76 | if settings.DEFAULT_FROM_EMAIL == "webmaster@localhost":
77 | messages.append('Set a valid email for DEFAULT_FROM_EMAIL')
78 |
79 | return messages
80 |
81 | def check_default_templates(self, templates=['404.html', '500.html']):
82 | messages = []
83 |
84 | for name in templates:
85 | if not self.has_template(name, settings.TEMPLATE_DIRS):
86 | messages.append('Template %s does not exist' % name)
87 |
88 | return messages
89 |
90 | def check_print_statement(self):
91 | import ast
92 | import os
93 | linenos = []
94 | linenos_list = []
95 |
96 | class PrintStatementFinder(ast.NodeVisitor):
97 | def visit_Print(self, node):
98 | if node.dest is None:
99 | linenos_list.append(node.values[0].lineno)
100 |
101 | for (path, dirs, files) in os.walk("."):
102 | for file_name in files:
103 | if file_name.endswith(".py"):
104 | with open(path + "/" + file_name, 'rU') as f:
105 | linenos_list = []
106 | PrintStatementFinder().visit(ast.parse("".join(f.readlines())))
107 | if linenos_list:
108 | linenos.append(path + "/" + file_name)
109 | linenos.append(linenos_list)
110 | if linenos:
111 | if self.verbosity >= '2':
112 | return ["There are print statements 'filename' , [list of linenos of print statements in the file ] ", linenos]
113 | else:
114 | return ["You have one or more print statements"]
115 | else:
116 | return []
117 |
118 | def check_ipdb_import(self):
119 | import ast
120 | import os
121 | linenos = []
122 | linenos_list = []
123 |
124 | class ImportIpdbFinder(ast.NodeVisitor):
125 | def visit_Import(self, node):
126 | for names in node.names:
127 | if names.name == "ipdb" or names.name == "pdb":
128 | linenos_list.append(node.lineno)
129 |
130 | def visit_ImportFrom(self, node):
131 | if node.names[0].name == "set_trace":
132 | linenos_list.append(node.lineno)
133 |
134 | for (path, dirs, files) in os.walk("."):
135 | for file_name in files:
136 | if file_name.endswith(".py"):
137 | with open(path + "/" + file_name, 'rU') as f:
138 | linenos_list = []
139 | ImportIpdbFinder().visit(ast.parse("".join(f.readlines())))
140 | if linenos_list:
141 | linenos.append(path + "/" + file_name)
142 | linenos.append(linenos_list)
143 | if linenos:
144 | if self.verbosity >= '2':
145 | return ["There are ipdb imports 'filename' , [list of linenos of ipdb import statements in the file ] ", linenos]
146 | else:
147 | return ["You have one or more ipdb import statements"]
148 | else:
149 | return []
150 |
151 | def run(self, options=None):
152 | self.verbosity = options['verbosity']
153 | messages = []
154 | for (name, method) in inspect.getmembers(self,
155 | predicate=inspect.ismethod):
156 | if name.startswith('check_'):
157 | messages += method()
158 |
159 | return messages
160 |
--------------------------------------------------------------------------------
/docs/Makefile:
--------------------------------------------------------------------------------
1 | # Makefile for Sphinx documentation
2 | #
3 |
4 | # You can set these variables from the command line.
5 | SPHINXOPTS =
6 | SPHINXBUILD = sphinx-build
7 | PAPER =
8 | BUILDDIR = _build
9 |
10 | # User-friendly check for sphinx-build
11 | ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
12 | $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
13 | endif
14 |
15 | # Internal variables.
16 | PAPEROPT_a4 = -D latex_paper_size=a4
17 | PAPEROPT_letter = -D latex_paper_size=letter
18 | ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
19 | # the i18n builder cannot share the environment and doctrees with the others
20 | I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
21 |
22 | .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext
23 |
24 | help:
25 | @echo "Please use \`make ' where is one of"
26 | @echo " html to make standalone HTML files"
27 | @echo " dirhtml to make HTML files named index.html in directories"
28 | @echo " singlehtml to make a single large HTML file"
29 | @echo " pickle to make pickle files"
30 | @echo " json to make JSON files"
31 | @echo " htmlhelp to make HTML files and a HTML help project"
32 | @echo " qthelp to make HTML files and a qthelp project"
33 | @echo " applehelp to make an Apple Help Book"
34 | @echo " devhelp to make HTML files and a Devhelp project"
35 | @echo " epub to make an epub"
36 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
37 | @echo " latexpdf to make LaTeX files and run them through pdflatex"
38 | @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
39 | @echo " text to make text files"
40 | @echo " man to make manual pages"
41 | @echo " texinfo to make Texinfo files"
42 | @echo " info to make Texinfo files and run them through makeinfo"
43 | @echo " gettext to make PO message catalogs"
44 | @echo " changes to make an overview of all changed/added/deprecated items"
45 | @echo " xml to make Docutils-native XML files"
46 | @echo " pseudoxml to make pseudoxml-XML files for display purposes"
47 | @echo " linkcheck to check all external links for integrity"
48 | @echo " doctest to run all doctests embedded in the documentation (if enabled)"
49 | @echo " coverage to run coverage check of the documentation (if enabled)"
50 |
51 | clean:
52 | rm -rf $(BUILDDIR)/*
53 |
54 | html:
55 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
56 | @echo
57 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
58 |
59 | dirhtml:
60 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
61 | @echo
62 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
63 |
64 | singlehtml:
65 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
66 | @echo
67 | @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
68 |
69 | pickle:
70 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
71 | @echo
72 | @echo "Build finished; now you can process the pickle files."
73 |
74 | json:
75 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
76 | @echo
77 | @echo "Build finished; now you can process the JSON files."
78 |
79 | htmlhelp:
80 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
81 | @echo
82 | @echo "Build finished; now you can run HTML Help Workshop with the" \
83 | ".hhp project file in $(BUILDDIR)/htmlhelp."
84 |
85 | qthelp:
86 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
87 | @echo
88 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \
89 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
90 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/django-production-ready.qhcp"
91 | @echo "To view the help file:"
92 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/django-production-ready.qhc"
93 |
94 | applehelp:
95 | $(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
96 | @echo
97 | @echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
98 | @echo "N.B. You won't be able to view it unless you put it in" \
99 | "~/Library/Documentation/Help or install it in your application" \
100 | "bundle."
101 |
102 | devhelp:
103 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
104 | @echo
105 | @echo "Build finished."
106 | @echo "To view the help file:"
107 | @echo "# mkdir -p $$HOME/.local/share/devhelp/django-production-ready"
108 | @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/django-production-ready"
109 | @echo "# devhelp"
110 |
111 | epub:
112 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
113 | @echo
114 | @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
115 |
116 | latex:
117 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
118 | @echo
119 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
120 | @echo "Run \`make' in that directory to run these through (pdf)latex" \
121 | "(use \`make latexpdf' here to do that automatically)."
122 |
123 | latexpdf:
124 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
125 | @echo "Running LaTeX files through pdflatex..."
126 | $(MAKE) -C $(BUILDDIR)/latex all-pdf
127 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
128 |
129 | latexpdfja:
130 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
131 | @echo "Running LaTeX files through platex and dvipdfmx..."
132 | $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
133 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
134 |
135 | text:
136 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
137 | @echo
138 | @echo "Build finished. The text files are in $(BUILDDIR)/text."
139 |
140 | man:
141 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
142 | @echo
143 | @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
144 |
145 | texinfo:
146 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
147 | @echo
148 | @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
149 | @echo "Run \`make' in that directory to run these through makeinfo" \
150 | "(use \`make info' here to do that automatically)."
151 |
152 | info:
153 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
154 | @echo "Running Texinfo files through makeinfo..."
155 | make -C $(BUILDDIR)/texinfo info
156 | @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
157 |
158 | gettext:
159 | $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
160 | @echo
161 | @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
162 |
163 | changes:
164 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
165 | @echo
166 | @echo "The overview file is in $(BUILDDIR)/changes."
167 |
168 | linkcheck:
169 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
170 | @echo
171 | @echo "Link check complete; look for any errors in the above output " \
172 | "or in $(BUILDDIR)/linkcheck/output.txt."
173 |
174 | doctest:
175 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
176 | @echo "Testing of doctests in the sources finished, look at the " \
177 | "results in $(BUILDDIR)/doctest/output.txt."
178 |
179 | coverage:
180 | $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
181 | @echo "Testing of coverage in the sources finished, look at the " \
182 | "results in $(BUILDDIR)/coverage/python.txt."
183 |
184 | xml:
185 | $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
186 | @echo
187 | @echo "Build finished. The XML files are in $(BUILDDIR)/xml."
188 |
189 | pseudoxml:
190 | $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
191 | @echo
192 | @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
193 |
--------------------------------------------------------------------------------
/docs/conf.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | #
3 | # django-production-ready documentation build configuration file, created by
4 | # sphinx-quickstart on Sat Sep 5 18:34:15 2015.
5 | #
6 | # This file is execfile()d with the current directory set to its
7 | # containing dir.
8 | #
9 | # Note that not all possible configuration values are present in this
10 | # autogenerated file.
11 | #
12 | # All configuration values have a default; values that are commented out
13 | # serve to show the default.
14 |
15 | # If extensions (or modules to document with autodoc) are in another directory,
16 | # add these directories to sys.path here. If the directory is relative to the
17 | # documentation root, use os.path.abspath to make it absolute, like shown here.
18 | #sys.path.insert(0, os.path.abspath('.'))
19 |
20 | # -- General configuration ------------------------------------------------
21 |
22 | # If your documentation needs a minimal Sphinx version, state it here.
23 | #needs_sphinx = '1.0'
24 |
25 | # Add any Sphinx extension module names here, as strings. They can be
26 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
27 | # ones.
28 | extensions = [
29 | 'sphinx.ext.autodoc',
30 | ]
31 |
32 | # Add any paths that contain templates here, relative to this directory.
33 | templates_path = ['_templates']
34 |
35 | # The suffix(es) of source filenames.
36 | # You can specify multiple suffix as a list of string:
37 | # source_suffix = ['.rst', '.md']
38 | source_suffix = '.rst'
39 |
40 | # The encoding of source files.
41 | #source_encoding = 'utf-8-sig'
42 |
43 | # The master toctree document.
44 | master_doc = 'index'
45 |
46 | # General information about the project.
47 | project = u'django-production-ready'
48 | copyright = u'2015, Team Agiliq'
49 | author = u'Team Agiliq'
50 |
51 | # The version info for the project you're documenting, acts as replacement for
52 | # |version| and |release|, also used in various other places throughout the
53 | # built documents.
54 | #
55 | # The short X.Y version.
56 | version = '0.1'
57 | # The full version, including alpha/beta/rc tags.
58 | release = '0.1.1'
59 |
60 | # The language for content autogenerated by Sphinx. Refer to documentation
61 | # for a list of supported languages.
62 | #
63 | # This is also used if you do content translation via gettext catalogs.
64 | # Usually you set "language" from the command line for these cases.
65 | language = None
66 |
67 | # There are two options for replacing |today|: either, you set today to some
68 | # non-false value, then it is used:
69 | #today = ''
70 | # Else, today_fmt is used as the format for a strftime call.
71 | #today_fmt = '%B %d, %Y'
72 |
73 | # List of patterns, relative to source directory, that match files and
74 | # directories to ignore when looking for source files.
75 | exclude_patterns = ['_build']
76 |
77 | # The reST default role (used for this markup: `text`) to use for all
78 | # documents.
79 | #default_role = None
80 |
81 | # If true, '()' will be appended to :func: etc. cross-reference text.
82 | #add_function_parentheses = True
83 |
84 | # If true, the current module name will be prepended to all description
85 | # unit titles (such as .. function::).
86 | #add_module_names = True
87 |
88 | # If true, sectionauthor and moduleauthor directives will be shown in the
89 | # output. They are ignored by default.
90 | #show_authors = False
91 |
92 | # The name of the Pygments (syntax highlighting) style to use.
93 | pygments_style = 'sphinx'
94 |
95 | # A list of ignored prefixes for module index sorting.
96 | #modindex_common_prefix = []
97 |
98 | # If true, keep warnings as "system message" paragraphs in the built documents.
99 | #keep_warnings = False
100 |
101 | # If true, `todo` and `todoList` produce output, else they produce nothing.
102 | todo_include_todos = False
103 |
104 |
105 | # -- Options for HTML output ----------------------------------------------
106 |
107 | # The theme to use for HTML and HTML Help pages. See the documentation for
108 | # a list of builtin themes.
109 | html_theme = 'alabaster'
110 |
111 | # Theme options are theme-specific and customize the look and feel of a theme
112 | # further. For a list of options available for each theme, see the
113 | # documentation.
114 | #html_theme_options = {}
115 |
116 | # Add any paths that contain custom themes here, relative to this directory.
117 | #html_theme_path = []
118 |
119 | # The name for this set of Sphinx documents. If None, it defaults to
120 | # " v documentation".
121 | #html_title = None
122 |
123 | # A shorter title for the navigation bar. Default is the same as html_title.
124 | #html_short_title = None
125 |
126 | # The name of an image file (relative to this directory) to place at the top
127 | # of the sidebar.
128 | #html_logo = None
129 |
130 | # The name of an image file (within the static path) to use as favicon of the
131 | # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
132 | # pixels large.
133 | #html_favicon = None
134 |
135 | # Add any paths that contain custom static files (such as style sheets) here,
136 | # relative to this directory. They are copied after the builtin static files,
137 | # so a file named "default.css" will overwrite the builtin "default.css".
138 | html_static_path = ['_static']
139 |
140 | # Add any extra paths that contain custom files (such as robots.txt or
141 | # .htaccess) here, relative to this directory. These files are copied
142 | # directly to the root of the documentation.
143 | #html_extra_path = []
144 |
145 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
146 | # using the given strftime format.
147 | #html_last_updated_fmt = '%b %d, %Y'
148 |
149 | # If true, SmartyPants will be used to convert quotes and dashes to
150 | # typographically correct entities.
151 | #html_use_smartypants = True
152 |
153 | # Custom sidebar templates, maps document names to template names.
154 | #html_sidebars = {}
155 |
156 | # Additional templates that should be rendered to pages, maps page names to
157 | # template names.
158 | #html_additional_pages = {}
159 |
160 | # If false, no module index is generated.
161 | #html_domain_indices = True
162 |
163 | # If false, no index is generated.
164 | #html_use_index = True
165 |
166 | # If true, the index is split into individual pages for each letter.
167 | #html_split_index = False
168 |
169 | # If true, links to the reST sources are added to the pages.
170 | #html_show_sourcelink = True
171 |
172 | # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
173 | #html_show_sphinx = True
174 |
175 | # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
176 | #html_show_copyright = True
177 |
178 | # If true, an OpenSearch description file will be output, and all pages will
179 | # contain a tag referring to it. The value of this option must be the
180 | # base URL from which the finished HTML is served.
181 | #html_use_opensearch = ''
182 |
183 | # This is the file name suffix for HTML files (e.g. ".xhtml").
184 | #html_file_suffix = None
185 |
186 | # Language to be used for generating the HTML full-text search index.
187 | # Sphinx supports the following languages:
188 | # 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
189 | # 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr'
190 | #html_search_language = 'en'
191 |
192 | # A dictionary with options for the search language support, empty by default.
193 | # Now only 'ja' uses this config value
194 | #html_search_options = {'type': 'default'}
195 |
196 | # The name of a javascript file (relative to the configuration directory) that
197 | # implements a search results scorer. If empty, the default will be used.
198 | #html_search_scorer = 'scorer.js'
199 |
200 | # Output file base name for HTML help builder.
201 | htmlhelp_basename = 'django-production-readydoc'
202 |
203 | # -- Options for LaTeX output ---------------------------------------------
204 |
205 | latex_elements = {
206 | # The paper size ('letterpaper' or 'a4paper').
207 | #'papersize': 'letterpaper',
208 |
209 | # The font size ('10pt', '11pt' or '12pt').
210 | #'pointsize': '10pt',
211 |
212 | # Additional stuff for the LaTeX preamble.
213 | #'preamble': '',
214 |
215 | # Latex figure (float) alignment
216 | #'figure_align': 'htbp',
217 | }
218 |
219 | # Grouping the document tree into LaTeX files. List of tuples
220 | # (source start file, target name, title,
221 | # author, documentclass [howto, manual, or own class]).
222 | latex_documents = [
223 | (master_doc, 'django-production-ready.tex', u'django-production-ready Documentation',
224 | u'Team Agiliq', 'manual'),
225 | ]
226 |
227 | # The name of an image file (relative to this directory) to place at the top of
228 | # the title page.
229 | #latex_logo = None
230 |
231 | # For "manual" documents, if this is true, then toplevel headings are parts,
232 | # not chapters.
233 | #latex_use_parts = False
234 |
235 | # If true, show page references after internal links.
236 | #latex_show_pagerefs = False
237 |
238 | # If true, show URL addresses after external links.
239 | #latex_show_urls = False
240 |
241 | # Documents to append as an appendix to all manuals.
242 | #latex_appendices = []
243 |
244 | # If false, no module index is generated.
245 | #latex_domain_indices = True
246 |
247 |
248 | # -- Options for manual page output ---------------------------------------
249 |
250 | # One entry per manual page. List of tuples
251 | # (source start file, name, description, authors, manual section).
252 | man_pages = [
253 | (master_doc, 'django-production-ready', u'django-production-ready Documentation',
254 | [author], 1)
255 | ]
256 |
257 | # If true, show URL addresses after external links.
258 | #man_show_urls = False
259 |
260 |
261 | # -- Options for Texinfo output -------------------------------------------
262 |
263 | # Grouping the document tree into Texinfo files. List of tuples
264 | # (source start file, target name, title, author,
265 | # dir menu entry, description, category)
266 | texinfo_documents = [
267 | (master_doc, 'django-production-ready', u'django-production-ready Documentation',
268 | author, 'django-production-ready', 'One line description of project.',
269 | 'Miscellaneous'),
270 | ]
271 |
272 | # Documents to append as an appendix to all manuals.
273 | #texinfo_appendices = []
274 |
275 | # If false, no module index is generated.
276 | #texinfo_domain_indices = True
277 |
278 | # How to display URL addresses: 'footnote', 'no', or 'inline'.
279 | #texinfo_show_urls = 'footnote'
280 |
281 | # If true, do not generate a @detailmenu in the "Top" node's menu.
282 | #texinfo_no_detailmenu = False
283 |
--------------------------------------------------------------------------------