ok

On Tue, Oct 3, 2017 at 1:44 PM, Ken Bolton <[email protected]> wrote:

> First tip: never install locally what can be deployed locally. use docker,
> vagrant, both, or something comparable.
>
> If it isn't in production, do not develop an undue fondness for it.
>
> iI you break it, roll it back. Roll it back to a working version, or start
> from scratch. Starting from scratch if it is not in prod is great in that
> it provides an opportunity to prove that your stuff works. Starting from
> scratch is sometimes cheaper. Get a base mezzanine going and `git clone`
> your changes into it. Speaking of git, your repository should not have
> site-packages! The deployment script runs pip to install and update
> dependencies listed in your requirements.txt.
>
> Have you tried the django shell command? Or the excellent shell_plus from
> django_extensions? They drop you into a REPL which will let you
> programmatically access your database contents to get and/or create models.
>
> I urge you to learn Django. Mezzanine is very much a Django application,
> and all your questions are really questions about Django.
>
> On Tue, Oct 3, 2017 at 4:10 PM, Malik Rumi <[email protected]> wrote:
>
>> The script was to convert and import *.odt (openoffice) files into
>> Mezzanine. It is purely a local install for my own use. I agree it does not
>> make sense that I ran into all these errors asking me to change things, but
>> here I am.  I laid out the history, if that helps you diagnose what is
>> going wrong here.
>>
>> I do have a git repo, and I thought of rolling it back, but when I looked
>> at it, it does not look like it reaches down into site-packages. Is that
>> normal, i.e., should a repo normally include site-packages as well as the
>> django / mezzanine / fill in the blank project itself?
>>
>> The script I was using, and some additional related issues, are described
>> in a separate, as yet unanswered post, here: https://groups.google.co
>> m/forum/#!topic/mezzanine-users/EPlT4ixe9VA Thanks.
>>
>> On Tue, Oct 3, 2017 at 12:06 PM, Ken Bolton <[email protected]> wrote:
>>
>>> 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 a topic in the
>>> Google Groups "Mezzanine Users" group.
>>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>>> pic/mezzanine-users/mzJDNr1xCIA/unsubscribe.
>>> To unsubscribe from this group and all its topics, 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.
>>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Mezzanine Users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/mezzanine-users/mzJDNr1xCIA/unsubscribe.
> To unsubscribe from this group and all its topics, 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