Can you explain what you mean when you write "trying to run Python script"?
What do you want this script to do, and how do you want it activated? Have
you tried using Django's `manage.py shell` command? There should be no
reason, with three months experience, for you to be anywhere near the
Django initialization process, which has nothing to do with running a
python script.

Is this a production server you used the `fab all` script to deploy, or is
this local development. If you used the `fab` commands, all of your
settings will just work.

You used version control for all your changes, right, so backing out of
your changes is a walk in the park. That sounds like a good course of
action. I make my junior developers create and destroy environments daily
so they don't develop an unreasonable phobia of either.

hth,
ken


On Tue, Oct 3, 2017 at 2:50 PM, Malik Rumi <[email protected]> wrote:

> UPDATE
>
> I have deduced that somewhere along the way, I triggered configuration
> changes that have led me to this point. As I said originally, this all
> seems to have sprung from the simple desire to run a python script. I don't
> know why that should be the case, but there it is. Now I am up against
> AUTH_USER_MODEL, and I have been here before, in another project. If this
> isn't set at the very beginning, you are screwed, and the Django docs tell
> you so. But since I am the only user, I never worried about any of that -
> until now. If I don't get some help here, the only option I see is to
> simply back out of all these changes, get my data, forget about the python
> script and while I am at it, forget about Mezzanine.
>
>
> On Sunday, October 1, 2017 at 4:40:54 PM UTC-7, Malik Rumi wrote:
>>
>> Greetings/
>>
>> I am trying to run a python script on Mezzanine, and have run into a slew
>> of errors I have not seen before. I have been using Mezzanine for about 3
>> months. This is the first time I have run a python script on it, however.
>>
>>
>> I assume these errors are coming now because of the python script:
>>
>> https://docs.djangoproject.com/en/1.11/ref/applications/#ini
>> tialization-process
>>
>>
>> However, once I got past the first error, new ones kept coming, in rapid
>> succession, as if my entire settings are wrong, and that strikes me as odd,
>> and questionable, since everything was working before. I am hoping someone
>> can help illuminate what is going on here.
>>
>>
>> These are my errors, in order:
>>
>>
>> Error 1: DEFAULT_INDEX_TABLESPACE, but settings are not configured. You
>> must either define the environment variable DJANGO_SETTINGS_MODULE or call
>> settings.configure() before accessing settings.
>>
>>
>> Solution: $ export DJANGO_SETTINGS_MODULE="my.settings"
>>
>>
>>
>> Error 2: raise AppRegistryNotReady("Apps aren't loaded yet.")
>>
>>
>> Solution: Added django.setup() to settings.
>>
>>
>>
>> Error 3: NameError: name 'django_setup' is not defined
>>
>>
>> Solution: Added imports for os, sys, and django to settings, added
>> explicit os.environ setting to settings for django settings module, and
>> appended to sys.path
>>
>>
>>
>> Error 4: raise ImproperlyConfigured("The SECRET_KEY setting must not be
>> empty.")
>>
>>
>> Solution: This really confused me at first. Then I saw that SECRET_KEY
>> was in local_settings.py, along with DEBUG = True, the database settings,
>> and the fabric settings. But since it has been working without issue before
>> now, for some reason it was no longer going over to local_settings.py and
>> finding SECRET_KEY there. I don't know why. Since this is purely a local
>> install, I just commented the exec to local_settings out, and moved all
>> that into my main settings.
>>
>>
>>
>> Error 5: RuntimeError: Model class django.contrib.sites.models.Site
>> doesn't declare an explicit app_label and isn't in an application in
>> INSTALLED_APPS.
>>
>>
>> Solution: django.contrib.sites.models.Site is not in INSTALLED APPS, but
>> django.contrib.sites is. I dug it up and put an app label on Site. But,
>> why do I even need Site?
>>
>>
>>
>> Error 6: RuntimeError: Model class 
>> django.contrib.contenttypes.models.ContentType
>> doesn't declare an explicit app_label and isn't in an application in
>> INSTALLED_APPS.
>>
>>
>> Solution: As you can see, this is exactly the same error, it just moved
>> on to the next app in line. I see no reason to have to go through all my
>> apps putting labels on them (but obviously I might have to). It was at this
>> point that I stopped to post here and see if someone could explain wtf is
>> going on here with all these config errors? Thanks.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Mezzanine Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to