diff options
| author | David Sanders <dsanders@rapilabs.com> | 2015-09-29 15:29:59 +1000 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-09-29 15:09:28 -0400 |
| commit | 60fe6efe503d40f64ff597ab049952883dec8402 (patch) | |
| tree | a26d7f304738afbeaead6a1f19523a5a541f452e | |
| parent | e21c6f34ded8a2b0a9b5a80ab069eb2e1b15067b (diff) | |
[1.9.x] Improved "“standalone” Django usage" example.
Backport of ae9f9dc37f39afeaa45c646cf6eef81beffcf021 from master
| -rw-r--r-- | docs/topics/settings.txt | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/docs/topics/settings.txt b/docs/topics/settings.txt index 2d44a84364..55e8d221c3 100644 --- a/docs/topics/settings.txt +++ b/docs/topics/settings.txt @@ -277,13 +277,15 @@ After you've either set :envvar:`DJANGO_SETTINGS_MODULE` or called ``configure()``, you'll need to call :func:`django.setup()` to load your settings and populate Django's application registry. For example:: + import django from django.conf import settings from myapp import myapp_defaults settings.configure(default_settings=myapp_defaults, DEBUG=True) django.setup() - # Now this script can use any part of Django it needs. + # Now this script or any imported module can use any part of Django it needs. + from myapp import models Note that calling ``django.setup()`` is only necessary if your code is truly standalone. When invoked by your Web server, or through :doc:`django-admin |
