Deployment/NameError Problem

16 views
Skip to first unread message

Richard Jackson

unread,
Jan 4, 2017, 10:35:02 AM1/4/17
to Django users
Hi there

I've been having some issues with my Mezzanine-powered site and have solved all issues locally (including a fresh migration covering all additional models). However, when I try to deploy the site to the server (WebFaction) I'm given a NameError:

[81.95.157.172] out:   File "vital_theme/admin.py", line 67, in <module>
[81.95.157.172] out:     class TuitionContentInline(StackedDynamicInlineAdmin):
[81.95.157.172] out:   File "vital_theme/admin.py", line 68, in TuitionContentInline
[81.95.157.172] out:     model = TuitionContent
[81.95.157.172] out: NameError: name 'TuitionContent' is not defined

At present admin.py looks like:

***START***

from models import (...
                    Tuition, TuitionContactIconBox, TuitionContent,
                    ...)

class TuitionContentInline(StackedDynamicInlineAdmin):
    model = TuitionContent

***END***

...and models.py contains:

***START***

[...]
# Tutorial Page
class Tuition(Page):
    heading = models.CharField(
        max_length=200,
        blank=True,
        help_text="The heading at the top of the page")
    subheading = models.CharField(
        max_length=200, blank=True,
        help_text="The subheading just below the heading")
    blurb = models.TextField(
        blank=True,
        help_text="Text under the headings")

    class Meta:
        verbose_name = _("Tuition")
        verbose_name_plural = _("Tuitions")


class TuitionContent(Orderable, RichText):
    tuition = models.ForeignKey(Tuition, related_name="contents")
    title = models.CharField("Title", max_length=50)
    icon = models.CharField("Icon", max_length=50)

***END***

Can anyone think of any reasons that this isn't deploying correctly, though is working fine locally? I may have missed important details so please let me know if this is the case.

Thanks for your time,

Rich

Antonis Christofides

unread,
Jan 4, 2017, 10:43:47 AM1/4/17
to django...@googlegroups.com

The error occurs in line 68 of admin.py. The admin.py you're showing doesn't seem to have 68 lines. Maybe the admin.py you have in development is not the same you have in production. Or the admin.py the system's reading is not the one you think it is (maybe it's reading it from another directory). You need to triple check that. Sometimes such errors are also caused by Python using its compiled files, *.pyc (in Python 2) or __pycache__/* (in Python 3). Normally it understands when a source file has changed and recompiles it, but for a variety of reasons it might fail to do so, so you might want to go and delete all compiled files.

Antonis Christofides
http://djangodeployment.com
--
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...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1ccf8f63-cdc6-404a-aeef-12efc630b9a6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages