Edited doc changes from [17246]

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17303 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2011-12-30 18:14:31 +00:00
parent d3ef13044e
commit de697769b7
3 changed files with 36 additions and 33 deletions

View File

@ -918,42 +918,44 @@ directory or the given destination.
.. versionchanged:: 1.4 .. versionchanged:: 1.4
By default the directory created contains a ``models.py`` file and other app By default the directory created contains a ``models.py`` file and other app
template files, see the `source`_ for more details. If only the app template files. (See the `source`_ for more details.) If only the app
name is given, the app directory will be created in the current working name is given, the app directory will be created in the current working
directory. directory.
If the optional destination is provided, it will be used to create the If the optional destination is provided, Django will create the new project
the new app directory in. The use of '.' to denote the current working directory in that directory. You can use '.' to denote the current working
directory is valid for the destination. For example:: directory.
For example::
django-admin.py startapp myapp /Users/jezdez/Code django-admin.py startapp myapp /Users/jezdez/Code
.. versionadded:: 1.4 .. versionadded:: 1.4
.. django-admin-option:: --template .. django-admin-option:: --template
With the ``--template`` option you can use a custom app template by providing With the ``--template`` option, you can use a custom app template by providing
either the path to a directory with the app template file, a path to a either the path to a directory with the app template file, or a path to a
compressed file (``.tar.gz``, ``.tar.bz2``, ``.tgz``, ``.tbz``, ``.zip``) compressed file (``.tar.gz``, ``.tar.bz2``, ``.tgz``, ``.tbz``, ``.zip``)
containing the app template files. containing the app template files.
Additionally Django will also accept URLs (``http``, ``https``, ``ftp``) to Django will also accept URLs (``http``, ``https``, ``ftp``) to compressed
compressed archives with the app template files, downloading and extracting archives with the app template files, downloading and extracting them on the
them on the fly. fly.
For example, this would look for an app template in the given directory when creating the ``myapp`` app:: For example, this would look for an app template in the given directory when
creating the ``myapp`` app::
django-admin.py startapp --template=/Users/jezdez/Code/my_app_template myapp django-admin.py startapp --template=/Users/jezdez/Code/my_app_template myapp
.. versionadded:: 1.4 .. versionadded:: 1.4
When Django copies the app template files it will also render the files When Django copies the app template files, it also renders the files
whose extension matches those passed with the ``--extension`` option (``py`` whose extension matches those passed with the ``--extension`` option (``py``
by default) using the template engine. The :class:`template context by default) using the template engine. The :class:`template context
<django.template.Context>` used is: <django.template.Context>` used is:
- Any option passed to the startapp command - Any option passed to the startapp command
- ``app_name`` -- the appp name as passed to the command - ``app_name`` -- the app name as passed to the command
- ``app_directory`` -- the full path of the newly created app - ``app_directory`` -- the full path of the newly created app
.. _render_warning: .. _render_warning:
@ -961,12 +963,12 @@ by default) using the template engine. The :class:`template context
.. warning:: .. warning::
When the app template files are rendered with the Django template When the app template files are rendered with the Django template
engine (by default all ``*.py`` files) it will also replace all engine (by default all ``*.py`` files), Django will also replace all
stray template variables contained. If one of the Python files for stray template variables contained. For example, if one of the Python files
example contains a docstring explaining a particular feature related contains a docstring explaining a particular feature related
to template rendering, it might result in an incorrect example. to template rendering, it might result in an incorrect example.
To work around this problem you can use the :ttag:`templatetag` To work around this problem, you can use the :ttag:`templatetag`
templatetag to "escape" the various parts of the template syntax. templatetag to "escape" the various parts of the template syntax.
.. _source: https://code.djangoproject.com/browser/django/trunk/django/conf/app_template/ .. _source: https://code.djangoproject.com/browser/django/trunk/django/conf/app_template/
@ -981,33 +983,35 @@ the current directory or the given destination.
.. versionchanged:: 1.4 .. versionchanged:: 1.4
By default the directory created contains a ``manage.py`` file and a project By default, the new directory contains ``manage.py`` and a project package
package (containing ``settings.py`` file and other project template files), (containing ``settings.py`` file and other project template files).
see the `template source`_ for more details. See the `template source`_ for details.
If only the project name is given, both the project directory and project If only the project name is given, both the project directory and project
package will be named ``<projectname>`` and the project directory package will be named ``<projectname>`` and the project directory
will be created in the current working directory. will be created in the current working directory.
If the optional destination is provided, it will be used to create the If the optional destination is provided, Django will create the new project
the new project directory in. The use of '.' to denote the current working directory in that directory. You can use '.' to denote the current working
directory is valid for the destination. For example:: directory.
For example::
django-admin.py startproject myproject /Users/jezdez/Code django-admin.py startproject myproject /Users/jezdez/Code
.. versionadded:: 1.4 .. versionadded:: 1.4
Similar to the :djadmin:`startapp` command the ``--template`` option is also As with the :djadmin:`startapp` command, the ``--template`` option lets you
available for specifying a directory or file path of a custom project specify a directory or file path of a custom project template. See the
template. See the :djadmin:`startapp` documentation for details of supported :djadmin:`startapp` documentation for details of supported project template
project template formats. formats.
For example, this would look for a project template in the given directory For example, this would look for a project template in the given directory
when creating the ``myproject`` project:: when creating the ``myproject`` project::
django-admin.py startproject --template=/Users/jezdez/Code/my_project_template myproject django-admin.py startproject --template=/Users/jezdez/Code/my_project_template myproject
When Django copies the project template files it will also render the files When Django copies the project template files, it will also render the files
whose extension matches those passed with the ``--extension`` option (``py`` whose extension matches those passed with the ``--extension`` option (``py``
by default) using the template engine. The :class:`template context by default) using the template engine. The :class:`template context
<django.template.Context>` used is: <django.template.Context>` used is:
@ -1022,7 +1026,6 @@ for :djadmin:`startapp`.
.. _`template source`: https://code.djangoproject.com/browser/django/trunk/django/conf/project_template/ .. _`template source`: https://code.djangoproject.com/browser/django/trunk/django/conf/project_template/
syncdb syncdb
------ ------

View File

@ -458,13 +458,13 @@ when running the following command::
django-admin.py startproject --template=/path/to/my_project_template myproject django-admin.py startproject --template=/path/to/my_project_template myproject
Additionally you can now provide a destination directory as the second You can also now provide a destination directory as the second
argument to both :djadmin:`startapp` and :djadmin:`startproject`:: argument to both :djadmin:`startapp` and :djadmin:`startproject`::
django-admin.py startapp myapp /path/to/new/app django-admin.py startapp myapp /path/to/new/app
django-admin.py startproject myproject /path/to/new/project django-admin.py startproject myproject /path/to/new/project
For more information see the :djadmin:`startapp` and :djadmin:`startproject` For more information, see the :djadmin:`startapp` and :djadmin:`startproject`
documentation. documentation.
Support for time zones Support for time zones

View File

@ -448,13 +448,13 @@ when running the following command::
django-admin.py startproject --template=/path/to/my_project_template myproject django-admin.py startproject --template=/path/to/my_project_template myproject
Additionally you can now provide a destination directory as the second You can also now provide a destination directory as the second
argument to both :djadmin:`startapp` and :djadmin:`startproject`:: argument to both :djadmin:`startapp` and :djadmin:`startproject`::
django-admin.py startapp myapp /path/to/new/app django-admin.py startapp myapp /path/to/new/app
django-admin.py startproject myproject /path/to/new/project django-admin.py startproject myproject /path/to/new/project
For more information see the :djadmin:`startapp` and :djadmin:`startproject` For more information, see the :djadmin:`startapp` and :djadmin:`startproject`
documentation. documentation.
Support for time zones Support for time zones