mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Fixed #18715 - Refactored tutorial 3. Thank-you Daniel Greenfeld!
This commit is contained in:
parent
08286ca5d9
commit
07abb7a6b7
3 changed files with 326 additions and 388 deletions
|
@ -440,20 +440,30 @@ Open your settings file (``mysite/settings.py``, remember) and look at the
|
|||
filesystem directories to check when loading Django templates. It's a search
|
||||
path.
|
||||
|
||||
Create a ``mytemplates`` directory in your project directory. Templates can
|
||||
live anywhere on your filesystem that Django can access. (Django runs as
|
||||
whatever user your server runs.) However, keeping your templates within the
|
||||
project is a good convention to follow.
|
||||
|
||||
When you’ve done that, create a directory polls in your template directory.
|
||||
Within that, create a file called index.html. Note that our
|
||||
``loader.get_template('polls/index.html')`` code from above maps to
|
||||
[template_directory]/polls/index.html” on the filesystem.
|
||||
|
||||
By default, :setting:`TEMPLATE_DIRS` is empty. So, let's add a line to it, to
|
||||
tell Django where our templates live::
|
||||
|
||||
TEMPLATE_DIRS = (
|
||||
'/home/my_username/mytemplates', # Change this to your own directory.
|
||||
'/path/to/mysite/mytemplates', # Change this to your own directory.
|
||||
)
|
||||
|
||||
Now copy the template ``admin/base_site.html`` from within the default Django
|
||||
admin template directory in the source code of Django itself
|
||||
(``django/contrib/admin/templates``) into an ``admin`` subdirectory of
|
||||
whichever directory you're using in :setting:`TEMPLATE_DIRS`. For example, if
|
||||
your :setting:`TEMPLATE_DIRS` includes ``'/home/my_username/mytemplates'``, as
|
||||
your :setting:`TEMPLATE_DIRS` includes ``'/path/to/mysite/mytemplates'``, as
|
||||
above, then copy ``django/contrib/admin/templates/admin/base_site.html`` to
|
||||
``/home/my_username/mytemplates/admin/base_site.html``. Don't forget that
|
||||
``/path/to/mysite/mytemplates/admin/base_site.html``. Don't forget that
|
||||
``admin`` subdirectory.
|
||||
|
||||
.. admonition:: Where are the Django source files?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue