diff --git a/docs/_theme/djangodocs-epub/epub-cover.html b/docs/_theme/djangodocs-epub/epub-cover.html
new file mode 100644
index 00000000000..e7ea0312441
--- /dev/null
+++ b/docs/_theme/djangodocs-epub/epub-cover.html
@@ -0,0 +1,10 @@
+{%- extends "epub/epub-cover.html" %}
+
+{% block content %}
+
+
Django Documentation
+
Release {{ release }}
+
{{ copyright }}
+
{{ last_updated }}
+
+{% endblock %}
diff --git a/docs/_theme/djangodocs-epub/static/docicons-behindscenes.png b/docs/_theme/djangodocs-epub/static/docicons-behindscenes.png
new file mode 120000
index 00000000000..3f1cd17ce2e
--- /dev/null
+++ b/docs/_theme/djangodocs-epub/static/docicons-behindscenes.png
@@ -0,0 +1 @@
+../../djangodocs/static/docicons-behindscenes.png
\ No newline at end of file
diff --git a/docs/_theme/djangodocs-epub/static/docicons-note.png b/docs/_theme/djangodocs-epub/static/docicons-note.png
new file mode 120000
index 00000000000..b8193a35d7a
--- /dev/null
+++ b/docs/_theme/djangodocs-epub/static/docicons-note.png
@@ -0,0 +1 @@
+../../djangodocs/static/docicons-note.png
\ No newline at end of file
diff --git a/docs/_theme/djangodocs-epub/static/docicons-philosophy.png b/docs/_theme/djangodocs-epub/static/docicons-philosophy.png
new file mode 120000
index 00000000000..26d9a0c5024
--- /dev/null
+++ b/docs/_theme/djangodocs-epub/static/docicons-philosophy.png
@@ -0,0 +1 @@
+../../djangodocs/static/docicons-philosophy.png
\ No newline at end of file
diff --git a/docs/_theme/djangodocs-epub/static/docicons-warning.png b/docs/_theme/djangodocs-epub/static/docicons-warning.png
new file mode 120000
index 00000000000..455195f35f1
--- /dev/null
+++ b/docs/_theme/djangodocs-epub/static/docicons-warning.png
@@ -0,0 +1 @@
+../../djangodocs/static/docicons-warning.png
\ No newline at end of file
diff --git a/docs/_theme/djangodocs-epub/static/epub.css b/docs/_theme/djangodocs-epub/static/epub.css
new file mode 100644
index 00000000000..b74af5e9bf0
--- /dev/null
+++ b/docs/_theme/djangodocs-epub/static/epub.css
@@ -0,0 +1,67 @@
+h1 { margin-top: 0; }
+
+/* Keep lists a bit narrow to maximize page estate regarding width. */
+ol, ul {
+ margin: 0;
+ padding: 0 0 0 1.3em;
+}
+
+/* Images should never exceed the width of the page. */
+img { max-width: 100%; }
+
+/* Don't display URL after links, this is not print. */
+.link-target { display: none; }
+
+/* This is the front cover page of the book. */
+.epub-cover { text-align: center; }
+.epub-cover h1 { margin: 4em 0 0 0; }
+.epub-cover h2 { margin: 1em 0; }
+.epub-cover h3 { margin: 3em 0 2em 0; }
+
+/* Code examples should never exceed the width of the page, so wrap instead. */
+pre, span.pre { white-space: pre-wrap; }
+
+pre {
+ background-color: #f6f6f6;
+ border: 0;
+ padding: 0.5em;
+ font-size: 90%;
+}
+
+/* Header for some code blocks. */
+.snippet-filename {
+ background-color: #393939;
+ color: white;
+ margin: 0;
+ padding: 0.5em;
+ font: bold 90% monospace;
+}
+.snippet-filename + .highlight > pre,
+.snippet-filename + pre {
+ margin-top: 0;
+}
+
+a:link, a:visited { color: #396623; }
+a:hover { color: #1d3311; }
+
+/* Use special styled note boxes from the default theme, but with the left side
+fitted after the icon, to allow text resizing with breaking. */
+.note, .admonition {
+ background-position: 9px 0.8em;
+ background-repeat: no-repeat;
+ padding: 0.8em 1em 0.8em 65px;
+ margin: 1em 0;
+ border: 0.01em solid black;
+}
+
+.note, .admonition { background-image: url(docicons-note.png); }
+div.admonition-philosophy { background-image: url(docicons-philosophy.png); }
+div.admonition-behind-the-scenes { background-image: url(docicons-behindscenes.png); }
+.admonition.warning { background-image: url(docicons-warning.png); }
+
+.admonition-title {
+ font-weight: bold;
+ margin: 0;
+}
+
+.admonition .last { margin-bottom: 0; }
diff --git a/docs/_theme/djangodocs-epub/theme.conf b/docs/_theme/djangodocs-epub/theme.conf
new file mode 100644
index 00000000000..8fa091823a6
--- /dev/null
+++ b/docs/_theme/djangodocs-epub/theme.conf
@@ -0,0 +1,8 @@
+[theme]
+inherit = epub
+stylesheet = epub.css
+pygments_style = trac
+
+[options]
+relbar1 = false
+footer = false
diff --git a/docs/conf.py b/docs/conf.py
index 6bc293d02af..ff919a6265f 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -273,10 +273,19 @@ texinfo_documents = [(
# -- Options for Epub output ---------------------------------------------------
# Bibliographic Dublin Core info.
-epub_title = 'Django'
+epub_title = project
epub_author = 'Django Software Foundation'
epub_publisher = 'Django Software Foundation'
-epub_copyright = '2010, Django Software Foundation'
+epub_copyright = copyright
+
+# The basename for the epub file. It defaults to the project name.
+#epub_basename = 'Django'
+
+# The HTML theme for the epub output. Since the default themes are not optimized
+# for small screen space, using the same theme for HTML and epub output is
+# usually not wise. This defaults to 'epub', a theme designed to save visual
+# space.
+epub_theme = 'djangodocs-epub'
# The language of the text. It defaults to the language option
# or en if the language is not set.
@@ -292,6 +301,12 @@ epub_copyright = '2010, Django Software Foundation'
# A unique identification for the text.
#epub_uid = ''
+# A tuple containing the cover image and cover page html template filenames.
+epub_cover = ('', 'epub-cover.html')
+
+# A sequence of (type, uri, title) tuples for the guide element of content.opf.
+#epub_guide = ()
+
# HTML files that should be inserted before the pages created by sphinx.
# The format is a list of tuples containing the path and title.
#epub_pre_files = []
@@ -308,3 +323,18 @@ epub_copyright = '2010, Django Software Foundation'
# Allow duplicate toc entries.
#epub_tocdup = True
+
+# Choose between 'default' and 'includehidden'.
+#epub_tocscope = 'default'
+
+# Fix unsupported image types using the PIL.
+#epub_fix_images = False
+
+# Scale large images.
+#epub_max_image_width = 0
+
+# How to display URL addresses: 'footnote', 'no', or 'inline'.
+#epub_show_urls = 'inline'
+
+# If false, no index is generated.
+#epub_use_index = True