{ "info": { "author": "Rithmio", "author_email": "devadmin@rithmio.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Framework :: Django :: 1.10", "Framework :: Django :: 1.8", "Framework :: Django :: 1.9", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "# django-mkdocs\n\nDjango-mkdocs is built on the premise that there is a need for simple, beautiful, maintainable documentation which can be user-permissioned. The app is *heavily inspired* by [django-documentation](https://github.com/Narsil/django-documentation) with updated compatibility for Django 1.10, and uses [MkDocs](http://www.mkdocs.org/) to generate a static-site served by Django.\n\nTo be clear, django-mkdocs was not intended for large-scale access. It was originally created to serve documentation internally and to select partners. If your documents are intended to be public, using MkDocs alone with github-pages or Amazon S3 may be a better solution.\n\n\n## Installation\n\nDjango-mkdocs can be installed directly from pip:\n```\n$ pip install django-mkdocs\n```\n\n### Plugging django-mkdocs into your Django project\n\nIn your Django project, add 'django_mkdocs' to your settings.py:\n```\nproject/settings.py\n\n\n\nINSTALLED_APPS = (\n...\n'django_mkdocs',\n)\n```\n\nAdd a reference to your projects urls.py:\n\n```\nproject/urls.py\n\n\n\nfrom django.conf.urls import url, include\n\n...\n...\n\nurlpatterns = [\n...\nurl(r'^docs/', include('django_mkdocs.urls', namespace='documentation')),\n]\n```\n\n### Setting up the MkDocs documentation\n\nMkDocs is included with django-mkdocs. The project naturally has excellent documentation and is linked [here](http://www.mkdocs.org/).\n\nWe recommend making a directory for your documentation in the root of your Django project, and starting a MkDocs project in there.\n\n```\n$ mkdocs new project_docs\n```\n\nYour directory structure should now look something like this:\n\n```\n\u251c\u2500\u2500 manage.py\n\u251c\u2500\u2500 project\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 __init__.py\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 settings.py\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 urls.py\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 wsgi.py\n\u2514\u2500\u2500 project_docs\n \u251c\u2500\u2500 docs\n \u2502\u00a0\u00a0 \u2514\u2500\u2500 index.md\n \u2514\u2500\u2500 mkdocs.yml\n```\n\nThe main configuration file for MkDocs is mkdocs.yml. Let's move it into the Django project root for easier builds later on:\n```\n$ mv project_docs/mkdocs.yml ./mkdocs.yml\n```\n\nNow we'll need to change a couple of references in this file.\n- **site_name** is the title of your HTML page\n- **pages** tells MkDocs your desired site-structure and which markdown files should be used to generate it\n- **docs_dir** refers to the markdown your documentation will be generated from, while\n- **site_dir** refers to the location where the static site will be generated.\n- Lastly, **use_directory_urls** should be set to false for Django's routing to work correctly.\n\n```\nmkdocs.yml\n\n\n\nsite_name: My Docs\npages:\n - Home: index.md\nuse_directory_urls: false\ndocs_dir: project_docs/docs\nsite_dir: project_docs/site\n\n```\n\nTo build the documentation, run the following command from the directory containing mkdocs.yml. We include the optional *--clean* flag here to signify that site_dir should be cleansed of page references that have been removed from our mkdocs.yml.\n```\n$ mkdocs build --clean\n```\n\nIt's also recommended that you add this command to your post-deployment script for fresh document builds each time you deploy.\n\n### Options for serving the documentation\n\nIn order to serve your docs, django-mkdocs needs to know where to look for them. These settings must be configured in your project's settings.py. Set the DOCUMENTATION_ROOT to the directory which contains both your **docs_dir** and **site_dir** folders. In this snippet, 'PROJECT_DIR' is the absolute path to our Django project.\n\n```\nproject/settings.py\n\n\n\n# django-mkdocs demo parameters!\nPROJECT_DIR = os.path.dirname(os.path.dirname(__file__))\nDOCUMENTATION_ROOT = PROJECT_DIR + '/project_docs'\n```\n\nDOCUMENTATION_HTML_ROOT points to the root of our statically generated site. This should correspond to the same directory as our mkdocs.yml site_dir.\n```\nDOCUMENTATION_HTML_ROOT = DOCUMENTATION_ROOT + '/site'\n```\n\nDOCUMENTATION_ACCESS_FUNCTION is used in the views that attempt to access the documentation. Django-mkdocs calls DOCUMENTATION_ACCESS_FUNCTION with request.user as an argument. This flag determines who has access to view the docs.\n```\nDOCUMENTATION_ACCESS_FUNCTION = lambda user: user.is_staff\n```\n\nDjango-mkdocs assumes an Nginx server is used by default to serve the documentation. DOCUMENTATION_XSENDFILE is set to true by default. If you are not using Nginx, expect a very small number of users, and understand the consequences of using django.views.static.serve, set the following flag:\n```\nDOCUMENTATION_XSENDFILE = False\n```\n\n## Viewing your documentation\nWith the above steps completed, you should now be able to view your static site at the endpoint defined in your project's urlconf. Let's test this out locally. First, run Django's development server from the project root:\n\n```\n$ python manage.py runserver\n```\n\nPoint your browser to localhost:8000/docs (or the url you referenced). You should now see your generated docs!\n\nNOTE: If following along in the demo project, you may need to run migrations and create a superuser. You will also need to authenticate at the django admin console at localhost:8000/admin after performing the following commands.\n\n```\n$ python manage.py migrate\n$ python manage.py createsuperuser\n```\n\n## Deploying to Heroku\n\nYou may also wish to have your documentation build automatically every time you deploy. One way to accomplish this with Heroku is to add a post deployment hook. From the root of your django project, create a directory named bin/, and in that directory, a script named *post_compile*.\n\n```\n$ mkdir bin\n$ touch bin/post_compile\n```\n\nYou can add any other shell commands you like, but let's add our build command.\n\n```\nbin/post_compile\n\n\necho \"-----> Building MkDocs documentation\"\nmkdocs build --clean\n```\n\nAnd your final directory tree should look like this:\n\n```\n\u251c\u2500\u2500 bin\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 post_compile\n\u251c\u2500\u2500 manage.py\n\u251c\u2500\u2500 mkdocs.yml\n\u251c\u2500\u2500 project\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 __init__.py\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 settings.py\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 urls.py\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 wsgi.py\n\u2514\u2500\u2500 project_docs\n \u251c\u2500\u2500 docs\n \u2502\u00a0\u00a0 \u2514\u2500\u2500 index.md\n \u2514\u2500\u2500 site\n```", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "UNKNOWN", "keywords": null, "license": "LGPL", "maintainer": null, "maintainer_email": null, "name": "django_mkdocs", "package_url": "https://pypi.org/project/django_mkdocs/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django_mkdocs/", "project_urls": { "Download": "UNKNOWN", "Homepage": "UNKNOWN" }, "release_url": "https://pypi.org/project/django_mkdocs/0.1.2/", "requires_dist": null, "requires_python": null, "summary": "MkDocs served by Django for permissioned access", "version": "0.1.2" }, "last_serial": 2453441, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "16dc3eebb5c89c2d06eb45cf0522d90b", "sha256": "ad2a2760531939c4db3b4bf721acdb7ea4bda7b4547070011edbb369ffa1d1e6" }, "downloads": -1, "filename": "django_mkdocs-0.1.1.tar.gz", "has_sig": false, "md5_digest": "16dc3eebb5c89c2d06eb45cf0522d90b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7478, "upload_time": "2016-09-08T19:12:54", "url": "https://files.pythonhosted.org/packages/52/ac/b4050c03442e7ec49f4572d94a32990be2f4d4c8c24b5bf9bccb1bbb8299/django_mkdocs-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "2ebd01ed3179a537d8d53ff1d1a7961c", "sha256": "d16491805f01f7a3c8d659c9b4614029d44e7429bdd11efa0a325ce17d79e30a" }, "downloads": -1, "filename": "django_mkdocs-0.1.2.tar.gz", "has_sig": false, "md5_digest": "2ebd01ed3179a537d8d53ff1d1a7961c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7846, "upload_time": "2016-11-10T17:08:08", "url": "https://files.pythonhosted.org/packages/a4/59/ab8f369321b26e43a2baac7be734068c0b2069d7411a175a37ce4bd2295f/django_mkdocs-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2ebd01ed3179a537d8d53ff1d1a7961c", "sha256": "d16491805f01f7a3c8d659c9b4614029d44e7429bdd11efa0a325ce17d79e30a" }, "downloads": -1, "filename": "django_mkdocs-0.1.2.tar.gz", "has_sig": false, "md5_digest": "2ebd01ed3179a537d8d53ff1d1a7961c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7846, "upload_time": "2016-11-10T17:08:08", "url": "https://files.pythonhosted.org/packages/a4/59/ab8f369321b26e43a2baac7be734068c0b2069d7411a175a37ce4bd2295f/django_mkdocs-0.1.2.tar.gz" } ] }