Permalink
Browse files

Refs #25, refs #39, refs #40, refs #42 - Big refactoring in documenta…

…tion and demo: narrative documentation uses examples from demo project.
  • Loading branch information...
benoitbryon committed Oct 28, 2013
1 parent 413f7a9 commit 874f3b9b544c08edc731085359f74d6838e16b4a
Showing with 1,028 additions and 792 deletions.
  1. +3 −1 AUTHORS
  2. +1 −1 LICENSE
  3. +8 −3 Makefile
  4. +16 −42 demo/README
  5. +0 −1 demo/demoproject/download/__init__.py
  6. +0 −7 demo/demoproject/download/models.py
  7. +0 −107 demo/demoproject/download/tests.py
  8. +0 −34 demo/demoproject/download/urls.py
  9. +0 −90 demo/demoproject/download/views.py
  10. +1 −1 demo/demoproject/{download → }/fixtures/demo.json
  11. 0 demo/demoproject/{download → }/fixtures/hello-world.txt
  12. +7 −0 demo/demoproject/http/__init__.py
  13. +1 −0 demo/demoproject/http/models.py
  14. +16 −0 demo/demoproject/http/tests.py
  15. +11 −0 demo/demoproject/http/urls.py
  16. +12 −0 demo/demoproject/http/views.py
  17. +1 −1 demo/demoproject/nginx/__init__.py
  18. +1 −0 demo/demoproject/nginx/models.py
  19. +25 −36 demo/demoproject/nginx/tests.py
  20. +6 −5 demo/demoproject/nginx/urls.py
  21. +14 −10 demo/demoproject/nginx/views.py
  22. +7 −0 demo/demoproject/object/__init__.py
  23. +8 −0 demo/demoproject/object/models.py
  24. +70 −0 demo/demoproject/object/tests.py
  25. +17 −0 demo/demoproject/object/urls.py
  26. +18 −0 demo/demoproject/object/views.py
  27. +7 −0 demo/demoproject/path/__init__.py
  28. +1 −0 demo/demoproject/path/models.py
  29. +28 −0 demo/demoproject/path/tests.py
  30. +14 −0 demo/demoproject/path/urls.py
  31. +39 −0 demo/demoproject/path/views.py
  32. +10 −6 demo/demoproject/settings.py
  33. +7 −0 demo/demoproject/storage/__init__.py
  34. +1 −0 demo/demoproject/storage/models.py
  35. +4 −0 demo/demoproject/storage/storage.py
  36. +48 −0 demo/demoproject/storage/tests.py
  37. +14 −0 demo/demoproject/storage/urls.py
  38. +20 −0 demo/demoproject/storage/views.py
  39. +1 −16 demo/demoproject/templates/home.html
  40. +23 −3 demo/demoproject/urls.py
  41. +7 −0 demo/demoproject/virtual/__init__.py
  42. +1 −0 demo/demoproject/virtual/models.py
  43. +40 −0 demo/demoproject/virtual/tests.py
  44. +17 −0 demo/demoproject/virtual/urls.py
  45. +33 −0 demo/demoproject/virtual/views.py
  46. +5 −1 django_downloadview/api.py
  47. +2 −2 django_downloadview/decorators.py
  48. +42 −2 django_downloadview/files.py
  49. +9 −5 django_downloadview/middlewares.py
  50. +10 −6 django_downloadview/nginx/decorators.py
  51. +6 −2 django_downloadview/nginx/middlewares.py
  52. +48 −28 django_downloadview/response.py
  53. +17 −8 django_downloadview/test.py
  54. +15 −3 django_downloadview/views/http.py
  55. +0 −2 django_downloadview/views/virtual.py
  56. +1 −0 docs/conf.py
  57. +1 −16 docs/dev.txt
  58. +17 −43 docs/optimizations/index.txt
  59. +70 −74 docs/optimizations/nginx.txt
  60. +41 −23 docs/overview.txt
  61. +22 −6 docs/responses.txt
  62. +11 −17 docs/settings.txt
  63. +28 −2 docs/testing.txt
  64. +48 −0 docs/views/custom.txt
  65. +2 −8 docs/views/http.txt
  66. +34 −33 docs/views/object.txt
  67. +12 −58 docs/views/path.txt
  68. +16 −18 docs/views/storage.txt
  69. +13 −71 docs/views/virtual.txt
View
@@ -9,5 +9,7 @@ Original code by `Novapost <http://www.novapost.fr>`_ team:
* Nicolas Tobo <https://github.com/nicolastobo>
* Lauréline Guérin <https://github.com/zebuline>
* Gregory Tappero <https://github.com/coulix>
* Rémy Hubscher <remy.hubscher@novapost.fr>
* Benoît Bryon <benoit@marmelune.net>
* Rémy Hubscher <remy.hubscher@novapost.fr>
Developers: https://github.com/benoitbryon/django-downloadview/graphs/contributors
View
@@ -2,7 +2,7 @@
License
#######
Copyright (c) 2012, Benoît Bryon.
Copyright (c) 2012-2013, Benoît Bryon.
All rights reserved.
Redistribution and use in source and binary forms, with or without
View
@@ -72,10 +72,15 @@ documentation: sphinx
demo: develop
mkdir -p var/media/document
$(BIN_DIR)/demo syncdb --noinput
cp $(ROOT_DIR)/demo/demoproject/download/fixtures/hello-world.txt var/media/document/
$(BIN_DIR)/demo loaddata $(ROOT_DIR)/demo/demoproject/download/fixtures/demo.json
# Install fixtures.
mkdir -p var/media
cp -r $(ROOT_DIR)/demo/demoproject/fixtures var/media/object
cp -r $(ROOT_DIR)/demo/demoproject/fixtures var/media/object-other
cp -r $(ROOT_DIR)/demo/demoproject/fixtures var/media/nginx
$(BIN_DIR)/demo loaddata demo.json
runserver: demo
$(BIN_DIR)/demo runserver
View
@@ -2,8 +2,20 @@
Demo project
############
The :file:`demo/` folder holds a demo project to illustrate django-downloadview
usage.
`Demo folder in project's repository`_ contains a Django project to illustrate
`django-downloadview` usage.
*****************************************
Documentation includes code from the demo
*****************************************
Almost every example in this documentation comes from the demo:
* discover examples in the documentation;
* browse related code and tests in demo project.
Examples in documentation are tested via demo project!
***********************
@@ -19,7 +31,7 @@ Deploy the demo
System requirements:
* `Python`_ version 2.6 or 2.7, available as ``python`` command.
* `Python`_ version 2.7, available as ``python`` command.
.. note::
@@ -34,7 +46,7 @@ Execute:
git clone git@github.com:benoitbryon/django-downloadview.git
cd django-downloadview/
make demo
make runserver
It installs and runs the demo server on localhost, port 8000. So have a look
at http://localhost:8000/
@@ -47,44 +59,6 @@ at http://localhost:8000/
Browse and use :file:`demo/demoproject/` as a sandbox.
*********************************
Base example provided in the demo
*********************************
In the "demoproject" project, there is an application called "download".
:file:`demo/demoproject/settings.py`:
.. literalinclude:: ../demo/demoproject/settings.py
:language: python
:lines: 33-49
:emphasize-lines: 44
This application holds a ``Document`` model.
:file:`demo/demoproject/download/models.py`:
.. literalinclude:: ../demo/demoproject/download/models.py
:language: python
.. note::
The ``storage`` is the default one, i.e. it uses ``settings.MEDIA_ROOT``.
Combined to this ``upload_to`` configuration, files for ``Document`` model
live in :file:`var/media/document/` folder, relative to your
django-downloadview clone root.
There is a download view named "download_document" for this model:
:file:`demo/demoproject/download/urls.py`:
.. literalinclude:: ../demo/demoproject/download/urls.py
:language: python
As is, Django is to serve the files, i.e. load chunks into memory and stream
them.
**********
References
**********

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.
@@ -1,7 +1,7 @@
[
{
"pk": 1,
"model": "download.document",
"model": "object.document",
"fields": {
"slug": "hello-world",
"file": "document/hello-world.txt"
@@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
"""Demo for :class:`django_downloadview.HTTPDownloadView`.
Code in this package is included in documentation's :doc:`/views/http`.
Make sure to maintain both together.
"""
@@ -0,0 +1 @@
"""Required to make a Django application."""
Oops, something went wrong.

0 comments on commit 874f3b9

Please sign in to comment.