我正在使用Mezzanine帮助构建我目前正在进行的项目,并且我在使COMMENTS_APP工作时遇到了问题。我已将自定义应用设为INSTALLED_APP,并表示它是COMMENTS_APP,请将此
from modify.models import CustomComment
from modify.forms import CustomCommentForm
def get_model():
return CustomComment
def get_form():
return CustomCommentForm
在应用的 init .py中。我已经把
了from django.db import models
from django.db.models.signals import class_prepared
from django.db import models
from django.utils.translation import ugettext_lazy as _
from mezzanine.core.fields import FileField, RichTextField
from mezzanine.core.models import RichText, Orderable, Slugged
from mezzanine.core.models import SiteRelated
from mezzanine.pages.models import Page
from mezzanine.blog.models import BlogPost
from mezzanine.utils.models import upload_to
from django_comments.models import Comment
class CustomComment(Comment):
pass
作为我的模特,我仍然有这个错误,而对于我的生活,我无法解决如何解决它。我错过了什么?导致此错误的原因是什么?这是追溯
Traceback (most recent call last):
File "manage.py", line 28, in <module>
execute_from_command_line(sys.argv)
File "/home/ashleyg/DisabilityProject/disproject/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/home/ashleyg/DisabilityProject/disproject/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute
django.setup()
File "/home/ashleyg/DisabilityProject/disproject/local/lib/python2.7/site-packages/django/__init__.py", line 21, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/ashleyg/DisabilityProject/disproject/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/home/ashleyg/DisabilityProject/disproject/local/lib/python2.7/site-packages/django/apps/config.py", line 87, in create
module = import_module(entry)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/ashleyg/DisabilityProject/rating/modify/__init__.py", line 1, in <module>
from modify.models import CustomComment
File "/home/ashleyg/DisabilityProject/rating/modify/models.py", line 5, in <module>
from mezzanine.core.models import RichText, Orderable, Slugged
File "/home/ashleyg/DisabilityProject/disproject/local/lib/python2.7/site-packages/mezzanine/core/models.py", line 24, in <module>
from mezzanine.core.managers import DisplayableManager, CurrentSiteManager
File "/home/ashleyg/DisabilityProject/disproject/local/lib/python2.7/site-packages/mezzanine/core/managers.py", line 16, in <module>
from mezzanine.conf import settings
File "/home/ashleyg/DisabilityProject/disproject/local/lib/python2.7/site-packages/mezzanine/conf/__init__.py", line 202, in <module>
module = import_module(app)
File "/home/ashleyg/DisabilityProject/disproject/local/lib/python2.7/site-packages/django/utils/importlib.py", line 46, in import_module
__import__(name)
ImportError: No module named CustomComment
这是我的pip冻结
Django==1.7.6
Mezzanine==3.1.10
Pillow==2.7.0
South==1.0.2
argparse==1.2.1
beautifulsoup4==4.1.3
bleach==1.4.1
django-autocomplete-light==2.0.9
django-choices==1.3
filebrowser-safe==0.3.8
future==0.9.0
grappelli-safe==0.3.13
html5lib==0.999
oauthlib==0.7.2
postgres==2.1.2
psycopg2==2.6
python-debian==0.1.23
pytz==2014.10
requests==2.6.0
requests-oauthlib==0.4.2
six==1.9.0
tzlocal==1.0
wsgiref==0.1.2