mirror of
https://github.com/swissmakers/netbox-plus.git
synced 2026-05-08 23:38:57 +02:00
Fix documentation issues and inclusion of docs to container
This commit is contained in:
@@ -6,8 +6,6 @@
|
||||
**/.mypy_cache
|
||||
.venv
|
||||
venv
|
||||
docs
|
||||
mkdocs.yml
|
||||
htmlcov
|
||||
.coverage
|
||||
*.egg-info
|
||||
|
||||
+11
-4
@@ -42,13 +42,18 @@ ENV PATH="/opt/netbox/venv/bin:${PATH}" \
|
||||
VIRTUAL_ENV=/opt/netbox/venv \
|
||||
PYTHONDONTWRITEBYTECODE=1
|
||||
|
||||
WORKDIR /opt/netbox/app
|
||||
|
||||
COPY requirements.txt /tmp/netbox-requirements.txt
|
||||
RUN pip install --no-cache-dir -r /tmp/netbox-requirements.txt gunicorn
|
||||
|
||||
# Application tree
|
||||
COPY netbox/ /opt/netbox/app/
|
||||
WORKDIR /opt/netbox
|
||||
COPY netbox/ ./app/
|
||||
COPY mkdocs.yml .
|
||||
COPY docs ./docs
|
||||
ENV BUILD_PUBLIC=1
|
||||
RUN ln -snf app netbox \
|
||||
&& mkdocs build \
|
||||
&& rm -f netbox \
|
||||
&& rm -rf docs mkdocs.yml
|
||||
|
||||
# Docker-specific Django configuration
|
||||
COPY docker/configuration_docker.py /opt/netbox/app/netbox/configuration_docker.py
|
||||
@@ -58,6 +63,8 @@ RUN chmod +x /docker/entrypoint.sh \
|
||||
&& mkdir -p /opt/netbox/app/static /opt/netbox/app/media \
|
||||
&& chmod -R g+w /opt/netbox/app/static /opt/netbox/app/media
|
||||
|
||||
WORKDIR /opt/netbox/app
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
ENTRYPOINT ["/docker/entrypoint.sh"]
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
site_name: NetBox Documentation
|
||||
site_name: NetBox Plus Documentation
|
||||
site_dir: netbox/project-static/docs
|
||||
site_url: https://swissmakers.ch/netbox-plus
|
||||
repo_name: swissmakers/netbox-plus
|
||||
|
||||
@@ -21,7 +21,15 @@ def _serve_static_if_enabled(request, path):
|
||||
"""
|
||||
if not getattr(settings, 'SERVE_STATIC_IN_APP', False):
|
||||
raise Http404()
|
||||
return serve(request, path, document_root=settings.STATIC_ROOT)
|
||||
try:
|
||||
return serve(request, path, document_root=settings.STATIC_ROOT)
|
||||
except Http404:
|
||||
# Django's static serve view does not resolve directory indexes. If a directory-style
|
||||
# URL is requested, try the conventional index.html before returning 404.
|
||||
normalized = path.rstrip('/')
|
||||
if normalized and not normalized.endswith('index.html'):
|
||||
return serve(request, f'{normalized}/index.html', document_root=settings.STATIC_ROOT)
|
||||
raise
|
||||
|
||||
|
||||
_patterns = [
|
||||
|
||||
Reference in New Issue
Block a user