Improved demo project: provided initial data and a simple homepage with some links.

This commit is contained in:
Benoît Bryon 2012-12-04 12:17:57 +01:00
parent 4f29852ddb
commit 0d2d38718e
5 changed files with 36 additions and 4 deletions

View file

@ -65,12 +65,13 @@ sphinx:
documentation: apidoc sphinx
runserver:
demo: develop
mkdir -p var/media/document
bin/demo syncdb --noinput
cp $(ROOT_DIR)/demo/demoproject/download/fixtures/hello-world.txt var/media/document/
bin/demo loaddata $(ROOT_DIR)/demo/demoproject/download/fixtures/demo.json
bin/demo runserver
demo: develop runserver
release:
bin/fullrelease

View file

@ -0,0 +1,10 @@
[
{
"pk": 1,
"model": "download.document",
"fields": {
"slug": "hello-world",
"file": "document/hello-world.txt"
}
}
]

View file

@ -125,6 +125,7 @@ INSTALLED_APPS = (
# 'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
'demoproject',
'demoproject.download',
'django_nose',
)

View file

@ -0,0 +1,15 @@
{% load url from future %}
<html>
<head>
<title>django-downloadview demo</title>
</head>
<body>
<h1>Welcome to django-downloadview demo!</h1>
<p>Here are some demo links. Browse the code to see how they are implemented</p>
<ul>
<li><a href="{% url 'download_hello_world' %}">DownloadView</a></li>
<li><a href="{% url 'download_document' 'hello-world' %}">ObjectDownloadView</a></li>
<li><a href="{% url 'download_document_nginx' 'hello-world' %}">ObjectDownloadView decorated with nginx X-Accel-Redirect</a> (better if served behind nginx)</li>
</ul>
</body>
</html>

View file

@ -1,6 +1,11 @@
from django.conf.urls import patterns, include, url
from django.views.generic import TemplateView
home = TemplateView.as_view(template_name='home.html')
urlpatterns = patterns('',
url(r'^download/', include('demoproject.download.urls')),
url(r'', home, name='home')
)