diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-12-30 15:42:15 +0100 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-12-30 22:11:17 +0100 |
| commit | 80d74097b4bd7186ad99b6d41d0ed90347a39b21 (patch) | |
| tree | 7b00c5113c311aaaeba4393701151e916ae7f9f0 /docs/intro/tutorial01.txt | |
| parent | 7ed20e015335076fc98ad805eaf241f8a0d872d5 (diff) | |
Stopped populating the app registry as a side effect.
Since it triggers imports, it shouldn't be done lightly.
This commit adds a public API for doing it explicitly, django.setup(),
and does it automatically when using manage.py and wsgi.py.
Diffstat (limited to 'docs/intro/tutorial01.txt')
| -rw-r--r-- | docs/intro/tutorial01.txt | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/docs/intro/tutorial01.txt b/docs/intro/tutorial01.txt index 4382f21a0f..0bd3d0abaf 100644 --- a/docs/intro/tutorial01.txt +++ b/docs/intro/tutorial01.txt @@ -602,9 +602,19 @@ the Python import path to your :file:`mysite/settings.py` file. .. admonition:: Bypassing manage.py If you'd rather not use :file:`manage.py`, no problem. Just set the - ``DJANGO_SETTINGS_MODULE`` environment variable to ``mysite.settings`` and - run ``python`` from the same directory :file:`manage.py` is in (or ensure - that directory is on the Python path, so that ``import mysite`` works). + :envvar:`DJANGO_SETTINGS_MODULE` environment variable to + ``mysite.settings``, start a plain Python shell, and set up Django:: + + >>> import django + >>> django.setup() + + If this raises an :exc:`~exceptions.AttributeError`, you're probably using + a version of Django that doesn't match this tutorial version. You'll want + to either switch to the older tutorial or the newer Django version. + + You must run ``python`` from the same directory :file:`manage.py` is in, + or ensure that directory is on the Python path, so that ``import mysite`` + works. For more information on all of this, see the :doc:`django-admin.py documentation </ref/django-admin>`. |
