Repository: cookiecutter/cookiecutter-django

Issue:
Set up auto-generated Sphinx API docs
We should be autogenerating the Sphinx API docs for `users.User`, `taskapp`, and every other similar area.



Discussion:

Resolving patch:
diff --git a/{{cookiecutter.project_slug}}/docs/conf.py b/{{cookiecutter.project_slug}}/docs/conf.py
--- a/{{cookiecutter.project_slug}}/docs/conf.py
+++ b/{{cookiecutter.project_slug}}/docs/conf.py
@@ -9,15 +9,19 @@
 # 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.
-#
+
 import os
 import sys
+import django
 
-# import django
-# sys.path.insert(0, os.path.abspath('..'))
-# os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")
-# django.setup()
-
+{% if cookiecutter.use_docker == 'y' %}
+sys.path.insert(0, os.path.abspath("/app"))
+os.environ.setdefault("DATABASE_URL", "")
+{% else %}
+sys.path.insert(0, os.path.abspath(".."))
+{%- endif %}
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")
+django.setup()
 
 # -- Project information -----------------------------------------------------
 
@@ -31,17 +35,19 @@
 # Add any Sphinx extension module names here, as strings. They can be
 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
 # ones.
-extensions = []
+extensions = [
+    "sphinx.ext.autodoc",
+    "sphinx.ext.napoleon",
+]
 
 # Add any paths that contain templates here, relative to this directory.
-templates_path = ["_templates"]
+# templates_path = ["_templates"]
 
 # List of patterns, relative to source directory, that match files and
 # directories to ignore when looking for source files.
 # This pattern also affects html_static_path and html_extra_path.
 exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
 
-
 # -- Options for HTML output -------------------------------------------------
 
 # The theme to use for HTML and HTML Help pages.  See the documentation for
@@ -52,4 +58,4 @@
 # 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"]
+# html_static_path = ["_static"]
diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/models.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/models.py
--- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/models.py
+++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/models.py
@@ -5,10 +5,17 @@
 
 
 class User(AbstractUser):
+    """Default user for {{cookiecutter.project_name}}.
+    """
 
-    # First Name and Last Name do not cover name patterns
-    # around the globe.
+    #: First and last name do not cover name patterns around the globe
     name = CharField(_("Name of User"), blank=True, max_length=255)
 
     def get_absolute_url(self):
+        """Get url for user's detail view.
+
+        Returns:
+            str: URL for user detail.
+
+        """
         return reverse("users:detail", kwargs={"username": self.username})


Test patch: