开发者

Error when deploying django app

I built an app using Django 1.3 and am now attempting to deploy to ubuntu 10.10 on linode using postgresql. I am using nginx on the front end and for static media and sending app requests to the app served with apache/mod_wsgi. Everything works fine on my local dev machine which is also Ubuntu 10.10 and I can install the app on my web server however when I try to access the home page I get the following error: 'str' object has no attribute '_default_manager'

According to the error messages it appears that it is having trouble with a modelform where I subclassed a field, changing it from a FK field to a URLField and performing the validation manually. This is the form that throwing the error:

class TopicResourceForm(ModelForm):
    resource = URLField(label='Resource URL')
    class Meta:
        model = TopicResource
        fields = ('title', 'rtype', 'note')

And these are the models.

class TopicResource(models.Model):
    added = models.DateTimeField(auto_now_add=True)
    updated = models.DateTimeField(auto_now=开发者_如何学编程True)
    title = models.CharField(max_length=140, blank=True)
    note = models.TextField(blank=True)
    resource = models.ForeignKey('aresource.Resource')
    rtype = models.ForeignKey('aresource.ResourceType', verbose_name="Resource Type", blank=True, null=True)
    topic = models.ForeignKey('mystudy.Topic')

    def __unicode__(self):
        return '%s on %s' % (self.resource, self.topic)

    def get_absolute_url(self):
        return '/topics/%s/%s/%s' % (self.topic.slug, self.resource.id,
        self.id)



class Resource(models.Model):
    added = models.DateTimeField(auto_now_add=True)
    updated = models.DateTimeField(auto_now=True)
    url = models.URLField(unique=True)
    rtype = models.ForeignKey(ResourceType, verbose_name="Resource Type", blank=True, null=True)

    def __unicode__(self):
        return '%s' % self.url

    def get_absolute_url(self):
        return '/resources/%s' % self.id

Any help would be appreciated, thanks.


It appears that your problem is similar to the one in this question Getting the "str" has no property "_default_manager" on a Django app just on startup . The answer to the question leads to a discussion with various suggested fixes. Hope that helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜