Moving docs to readthedocs.org

This commit is contained in:
Jeremy Stretch
2016-07-08 12:07:04 -04:00
parent e9fcac1557
commit b84b3d3b51
9 changed files with 43 additions and 80 deletions

View File

@@ -2,7 +2,7 @@ from django.conf.urls import include, url
from django.contrib import admin
from django.views.defaults import page_not_found
from views import home, docs, trigger_500
from views import home, trigger_500
from users.views import login, logout
@@ -30,10 +30,6 @@ urlpatterns = [
url(r'^api/docs/', include('rest_framework_swagger.urls')),
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
# Dcoumentation
url(r'^docs/$', docs, kwargs={'path': 'index'}, name='docs_root'),
url(r'^docs/(?P<path>[\w-]+)/$', docs, name='docs'),
# Error testing
url(r'^404/$', page_not_found),
url(r'^500/$', trigger_500),

View File

@@ -45,25 +45,6 @@ def home(request):
})
def docs(request, path):
"""
Display a page of Markdown-formatted documentation.
"""
filename = '{}/docs/{}.md'.format(settings.BASE_DIR.rsplit('/', 1)[0], path)
try:
with open(filename, 'r') as docfile:
markup = docfile.read()
except:
raise Http404
content = mark_safe(markdown(markup, extensions=['mdx_gfm', 'toc']))
return render(request, 'docs.html', {
'content': content,
'path': path,
})
def trigger_500(request):
"""Hot-wired method of triggering a server error to test reporting."""

View File

@@ -252,7 +252,7 @@
</div>
<div class="col-md-4 text-right">
<p class="text-muted">
<i class="fa fa-fw fa-book text-primary"></i> <a href="{% url 'docs_root' %}">Docs</a> &middot;
<i class="fa fa-fw fa-book text-primary"></i> <a href="http://netbox.readthedocs.io/" target="_blank">Docs</a> &middot;
<i class="fa fa-fw fa-cloud text-primary"></i> <a href="/api/docs/">API</a> &middot;
<i class="fa fa-fw fa-code text-primary"></i> <a href="https://github.com/digitalocean/netbox">Code</a>
</p>