Friday, March 28, 2014

Re: settings set in stone on import?

Hi Erik,

hey, that worked! I had to reload both the django.conf and django.core.management modules, but after doing that calling Django management commands that depend on valid settings seems to work just fine. Thank you for the suggestion.

Before you replied I was contemplating just calling the call_command('startproject', ...) function in another process using multiprocessing. Maybe I'll try that just to see if it'd work, but I'll be sticking with reloading.

Cheers!

On Friday, March 28, 2014 2:43:56 PM UTC+1, Erik Cederstrand wrote:
Hello Tin,

Den 27/03/2014 kl. 22.45 skrev Tin Tvrtković <tinch...@gmail.com>:

> Is there a way to make Django reread DJANGO_SETTINGS_MODULE after it has been imported? Also, it would seem django.core.management.call_command doesn't take a 'settings' keyword argument, like django-admin.py does.

The standard Python built-in function reload() http://docs.python.org/2.7/library/functions.html#reload should be able to do this.

Erik

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a0a8eb3c-c607-4ea8-92c7-b79c29e9ac1b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment