diff --git a/.gitignore b/.gitignore index bdaab25..0e3a3b5 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ +__pycache__/ env/ +drfdocs.egg-info/ diff --git a/MANIFEST.in b/MANIFEST.in index e69de29..aa9cba7 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -0,0 +1,7 @@ +include README.md +include LICENSE + +recursive-include drfdocs/static *.js *.css *.png *.eot *.svg *.ttf *.woff +recursive-include drfdocs/templates *.html +recursive-exclude * __pycache__ +recursive-exclude * *.py[co] diff --git a/README.md b/README.md index 9c9cc09..49216b3 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,38 @@ -# drf-docs -Documentation for Web APIs made with Django Rest Framework +# drf-docs [![Build Status](https://travis-ci.com/ekonstantinidis/drf-docs.svg?token=9QR4ewbqbkEmHps6q5sq&branch=master)](https://travis-ci.com/ekonstantinidis/drf-docs) +Documentation for Web APIs made with Django Rest Framework. ### Prerequisites - Python (3.3, 3.4, 3.5) - Django (1.8, 1.9) + - Django Rest Framework (3+) ### Development pyvenv env env/bin/pip install -r requirements.txt + + # To test within another django project + pip install -e ~/Projects/drf-docs/ + +### Installation + +Install using pip: + + pip install drfdocs + +Add 'drfdocs' to your `INSTALLED_APPS` setting: + + INSTALLED_APPS = ( + ... + 'drfdocs', + ) + +Finally include the `drfdocs` urls in your `urls.py`: + + urlpatterns = [ + ... + url(r'^docs/', include('drfdocs.urls', namespace='drfdocs')), + ] diff --git a/drfdocs/templates/drfdocs/base.html b/drfdocs/templates/drfdocs/base.html new file mode 100644 index 0000000..39f414c --- /dev/null +++ b/drfdocs/templates/drfdocs/base.html @@ -0,0 +1,11 @@ + + + + + DRF Docs + + +

Django Rest Frameworks Docs

+ + + diff --git a/drfdocs/templates/drfdocs/home.html b/drfdocs/templates/drfdocs/home.html new file mode 100644 index 0000000..9f291cc --- /dev/null +++ b/drfdocs/templates/drfdocs/home.html @@ -0,0 +1 @@ +{% extends "drfdocs/base.html" %} diff --git a/drfdocs/urls.py b/drfdocs/urls.py new file mode 100644 index 0000000..bda0460 --- /dev/null +++ b/drfdocs/urls.py @@ -0,0 +1,7 @@ +from django.conf.urls import url +from drfdocs.views import DRFDocsView + +urlpatterns = [ + # Url to view the API Docs + url(r'^$', DRFDocsView.as_view(), name='drfdocs'), +] diff --git a/drfdocs/views.py b/drfdocs/views.py new file mode 100644 index 0000000..815285e --- /dev/null +++ b/drfdocs/views.py @@ -0,0 +1,11 @@ +from django.views.generic.base import TemplateView + + +class DRFDocsView(TemplateView): + + template_name = "drfdocs/home.html" + + def get_context_data(self, **kwargs): + context = super(DRFDocsView, self).get_context_data(**kwargs) + context['example'] = True + return context diff --git a/setup.py b/setup.py index 2fab0f9..931e684 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import find_packages, setup setup( - name="drf-docs", + name="drfdocs", version=__import__('drfdocs').__version__, author="Emmanouil Konstantinidis", author_email="manos@iamemmanouil.com", @@ -10,7 +10,7 @@ url="http://www.drfdocs.com", license='BSD', description="Documentation for Web APIs made with Django Rest Framework.", - long_description=open("README.txt").read(), + long_description=open("README.md").read(), install_requires=[], classifiers=[ 'Development Status :: 5 - Production/Stable',