#24150: collectstatic -- using django.conf.settings
-------------------------------+--------------------
     Reporter:  abhillman      |      Owner:  nobody
         Type:  Uncategorized  |     Status:  new
    Component:  Uncategorized  |    Version:  1.7
     Severity:  Normal         |   Keywords:
 Triage Stage:  Unreviewed     |  Has patch:  0
Easy pickings:  0              |      UI/UX:  0
-------------------------------+--------------------
 Here is the help text for the collectstatic command:

 {{{
 $ ./manage.py collectstatic --help
 Usage: ./manage.py collectstatic [options]

 Collect static files in a single location.

 Options:
   -v VERBOSITY, --verbosity=VERBOSITY
                         Verbosity level; 0=minimal output, 1=normal
 output,
                         2=verbose output, 3=very verbose output
   --settings=SETTINGS   The Python path to a settings module, e.g.
                         "myproject.settings.main". If this isn't provided,
 the
                         DJANGO_SETTINGS_MODULE environment variable will
 be
                         used.
   --pythonpath=PYTHONPATH
                         A directory to add to the Python path, e.g.
                         "/home/djangoprojects/myproject".
   --traceback           Raise on exception
   --no-color            Don't colorize the command output.
   --noinput             Do NOT prompt the user for input of any kind.
   --no-post-process     Do NOT post process collected files.
   -i PATTERN, --ignore=PATTERN
                         Ignore files or directories matching this glob-
 style
                         pattern. Use multiple times to ignore more.
   -n, --dry-run         Do everything except modify the filesystem.
   -c, --clear           Clear the existing files using the storage before
                         trying to copy or link the original file.
   -l, --link            Create a symbolic link to each file instead of
                         copying.
   --no-default-ignore   Don't ignore the common private glob-style
 patterns
                         'CVS', '.*' and '*~'.
   --version             show program's version number and exit
   -h, --help            show this help message and exit
 }}}

 Clearly mentioned is a {{{--settings}} flag, which takes a path to a
 django settings file. Supposing, however, that we want to run
 collectstatic from a script and want to dynamically modify our settings
 file. For example, something like

 {{{
 from django.conf import settings
 from django.core.management import ManagementUtility

 settings.USE_S3 = False
 m = ManagementUtility(['', 'collectstatic'])
 m.execute()
 }}}

 The command instead uses the settings specified at the shell variable
 {{{DJANGO_SETTINGS_MODULE}}} instead of the dynamic settings. Kind of
 pesky to have to create a separate settings file to get control of this
 sort of thing.

--
Ticket URL: <https://code.djangoproject.com/ticket/24150>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.740fada5302827643f29cce43615da73%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to