|
| 1 | +# djangocms-rest Documentation |
| 2 | + |
| 3 | +This directory contains the documentation for djangocms-rest, built with Sphinx. |
| 4 | + |
| 5 | +## Setup |
| 6 | + |
| 7 | +### Using Poetry (Recommended) |
| 8 | + |
| 9 | +```bash |
| 10 | +# From project root, install all dependencies including docs |
| 11 | +poetry install --with dev |
| 12 | + |
| 13 | +# Navigate to the docs directory |
| 14 | +cd docs |
| 15 | + |
| 16 | +# Build the documentation |
| 17 | +make html |
| 18 | +``` |
| 19 | + |
| 20 | +### Alternative: Using pip |
| 21 | + |
| 22 | +```bash |
| 23 | +# From project root, install development dependencies |
| 24 | +pip install -e ".[dev]" |
| 25 | + |
| 26 | +# Navigate to the docs directory |
| 27 | +cd docs |
| 28 | + |
| 29 | +# Build the documentation |
| 30 | +make html |
| 31 | +``` |
| 32 | + |
| 33 | +## Building Documentation |
| 34 | + |
| 35 | +### Build HTML Documentation |
| 36 | + |
| 37 | +```bash |
| 38 | +# Build the documentation |
| 39 | +make html |
| 40 | + |
| 41 | +# Or use sphinx-build directly |
| 42 | +sphinx-build -b html . _build/html |
| 43 | +``` |
| 44 | + |
| 45 | +### View Documentation Locally |
| 46 | + |
| 47 | +```bash |
| 48 | +# Build and serve documentation |
| 49 | +make serve |
| 50 | + |
| 51 | +# Or build and open in browser |
| 52 | +make html |
| 53 | +make open |
| 54 | +``` |
| 55 | + |
| 56 | +### Development Mode with Live Reload |
| 57 | + |
| 58 | +```bash |
| 59 | +# Start live documentation server with auto-reload (recommended) |
| 60 | +sh live.sh |
| 61 | + |
| 62 | +# Or run sphinx-autobuild directly |
| 63 | +poetry run sphinx-autobuild . _build/html --port 8000 --host 0.0.0.0 --open-browser |
| 64 | + |
| 65 | +# Build with warnings treated as errors |
| 66 | +make dev |
| 67 | + |
| 68 | +# Watch for changes and rebuild automatically |
| 69 | +make watch |
| 70 | +``` |
| 71 | + |
| 72 | +## Available Make Targets |
| 73 | + |
| 74 | +- `make html` - Build HTML documentation |
| 75 | +- `make clean` - Clean build directory |
| 76 | +- `make serve` - Serve documentation on http://localhost:8000 |
| 77 | +- `make open` - Open documentation in browser |
| 78 | +- `make live` - Start live server with auto-reload (recommended for development) |
| 79 | +- `make dev` - Build in development mode with warnings |
| 80 | +- `make watch` - Watch for changes and rebuild automatically |
| 81 | +- `make help` - Show all available targets |
| 82 | + |
| 83 | +## Documentation Structure |
| 84 | + |
| 85 | +The documentation is organized into logical sections: |
| 86 | + |
| 87 | +### Tutorial |
| 88 | +- `tutorial/01-quickstart.rst` - Quick start guide |
| 89 | +- `tutorial/02-installation.rst` - Installation guide |
| 90 | +- `tutorial/03-openapi-documentation.rst` - OpenAPI documentation guide |
| 91 | + |
| 92 | +### How-to Guides |
| 93 | +- `how-to/01-use-multi-site.rst` - Multi-site configuration guide |
| 94 | +- `how-to/02-plugin-creation.rst` - Plugin creation guide |
| 95 | + |
| 96 | +### Reference |
| 97 | +- `reference/index.rst` - API overview |
| 98 | +- `reference/pages.rst` - Pages API reference |
| 99 | +- `reference/languages.rst` - Languages API reference |
| 100 | +- `reference/placeholders.rst` - Placeholders API reference |
| 101 | +- `reference/plugins.rst` - Plugins API reference |
| 102 | +- `reference/menu.rst` - Menu API reference |
| 103 | +- `reference/breadcrumbs.rst` - Breadcrumbs API reference |
| 104 | +- `reference/submenu.rst` - Submenu API reference |
| 105 | + |
| 106 | +### Additional |
| 107 | +- `contributing.rst` - Contributing guide |
| 108 | +- `changelog.rst` - Version history |
| 109 | + |
| 110 | +## Configuration |
| 111 | + |
| 112 | +The documentation is configured in `conf.py`. Key settings include: |
| 113 | + |
| 114 | +- **Theme**: Furo theme (modern, clean design with sidebar navigation) |
| 115 | +- **Extensions**: autodoc, intersphinx, napoleon, sphinx-tabs, sphinx-copybutton, etc. |
| 116 | +- **Intersphinx**: Links to Python, Django, DRF, and django CMS documentation |
| 117 | +- **Mock imports**: Django and django CMS modules are mocked for autodoc |
| 118 | +- **GitHub Integration**: Source repository links and GitHub icon in footer |
| 119 | + |
| 120 | +## Contributing to Documentation |
| 121 | + |
| 122 | +1. Make changes to the `.rst` files |
| 123 | +2. Build the documentation to check for errors: `make html` |
| 124 | +3. Test locally: `make serve` |
| 125 | +4. Submit a pull request |
| 126 | + |
| 127 | +## Troubleshooting |
| 128 | + |
| 129 | +### Common Issues |
| 130 | + |
| 131 | +**ImportError: No module named 'django'** |
| 132 | +- This is expected when building documentation without Django installed |
| 133 | +- The `conf.py` file includes mock imports for Django modules |
| 134 | + |
| 135 | +**Sphinx build errors** |
| 136 | +- Check that all dependencies are installed: `poetry install --with dev` or `pip install -e ".[dev]"` |
| 137 | +- Ensure you're in the `docs` directory when running commands |
| 138 | +- Check the build output for specific error messages |
| 139 | + |
| 140 | +**Missing intersphinx links** |
| 141 | +- The documentation links to external documentation (Python, Django, etc.) |
| 142 | +- These links may not work offline |
| 143 | +- This is normal behavior |
| 144 | + |
| 145 | +### Getting Help |
| 146 | + |
| 147 | +- Check the [Sphinx documentation](https://www.sphinx-doc.org/) |
| 148 | +- Review the [Read the Docs theme documentation](https://sphinx-rtd-theme.readthedocs.io/) |
| 149 | +- Open an issue on the project repository |
0 commit comments