Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions docs/management/commands/update_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import shutil
import subprocess
import sys
import zipfile
from contextlib import closing
from datetime import datetime
from pathlib import Path

Expand Down Expand Up @@ -243,31 +241,6 @@ def build_doc_release(self, release, force=False, interactive=False):
)
return

#
# Create a zip file of the HTML build for offline reading.
# This gets moved into MEDIA_ROOT for downloading.
#
html_build_dir = parent_build_dir.joinpath("_build", "djangohtml")
zipfile_name = f"django-docs-{release.version}-{release.lang}.zip"
zipfile_path = Path(settings.MEDIA_ROOT).joinpath("docs", zipfile_name)
if not zipfile_path.parent.exists():
zipfile_path.parent.mkdir(parents=True)
if self.verbosity >= 2:
self.stdout.write(" build zip (into %s)" % zipfile_path)

def zipfile_inclusion_filter(file_path):
return ".doctrees" not in file_path.parts

with closing(
zipfile.ZipFile(str(zipfile_path), "w", compression=zipfile.ZIP_DEFLATED)
) as zf:
for root, dirs, files in os.walk(str(html_build_dir)):
for f in files:
file_path = Path(os.path.join(root, f))
if zipfile_inclusion_filter(file_path):
rel_path = str(file_path.relative_to(html_build_dir))
zf.write(str(file_path), rel_path)

#
# Copy the build results to the directory used for serving
# the documentation in the least disruptive way possible.
Expand Down
2 changes: 1 addition & 1 deletion docs/templates/docs/doc.html
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ <h3 id="links-wrapper-header">{% trans "Download:" %}</h3>
<p>
{% if version == "dev" %}{% trans "Offline (development version):" %}
{% else %}{% blocktrans %}Offline (Django {{ version }}):{% endblocktrans %}{% endif %}
<a href="{{ MEDIA_URL }}docs/django-docs-{{ version }}-{{ lang }}.zip">HTML</a> |
<a href="https://media.readthedocs.org/htmlzip/django/{{ rtd_version }}/django.zip">HTML</a> |
<a href="https://media.readthedocs.org/pdf/django/{{ rtd_version }}/django.pdf">PDF</a> |
<a href="https://media.readthedocs.org/epub/django/{{ rtd_version }}/django.epub">ePub</a>
<br>
Expand Down