I'm able to configure a new Django project to serve static files. This is the project layout:
.
├── __init__.py
├── manage.py
├── settings.py
├── mystatic
│ └── index.html
└── urls.py
settings.py:
STATICFILES_DIRS = (
join(abspath(dirname(__file__)), 'mystatic'),
)
I run the server the usual way:
./manage.py runserver
This works pretty well. At http://127.0.0.1:8000/static/index.html
it shows my custom index page. What I'd like to do is access to http://127.0.0.1:8000/static/
(with or without trailing slash) and get the same page. Instead the server doesn't respond with my own page, but with the default Django project page (It worked! Congratulations on your first Django-powered page. etc.).
How should I change things (maybe in urls.py or in some view), so that even if without specifying index.html
both the URLs give the page I want? Using plain Apache this is the default behavior, because when a page name is not specified index.html
is used (see Apache's DirectoryIndex). I need to replicate the same on Django development server.