我正试图使用machina框架在我的django网站上创建一个论坛。我已根据文档(https://django-machina.readthedocs.io/en/stable/customization/recipes/overriding_models.html)修改了forum_member应用。我的目标结构如下: 项目有主要的应用程序和manage.py。 在这个项目文件夹中,有另一个名为apps的文件夹,其中包含machina的覆盖应用程序。
folder\<project apps>
folder\manage.py
folder\forumapps.pth
folder\apps
folder\apps\__init__.py
folder\apps\forum_member
folder\apps\forum_member\__init__.py
folder\apps\forum_member\models.py
folder\apps\forum_member\migrations
folder\apps\forum_member\migrations\<migrations files copied from the original forum_member in machina installation in python>Lib>site-packages>
我的settings.py:
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'payments',
'social.apps.django_app.default',
'mptt',
'haystack',
'widget_tweaks',
'pagedown',
'forum_member',
) + tuple(get_machina_apps())
我在项目级别添加了一个包含以下内容的forumapps.pth文件:
# machina package configuration
apps
现在,当我运行python manage.py makemigrations forum_member
时,它会显示以下错误:
E:\btcat>python manage.py makemigrations forum_member
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line
353, in execute_from_command_line
utility.execute()
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line
327, in execute
django.setup()
File "C:\Python27\lib\site-packages\django\__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Python27\lib\site-packages\django\apps\registry.py", line 85, in popu
late
app_config = AppConfig.create(entry)
File "C:\Python27\lib\site-packages\django\apps\config.py", line 90, in create
module = import_module(entry)
File "C:\Python27\lib\importlib\__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named forum_member
我正在通过互联网寻找解决方案,但无济于事。任何人都可以帮助我理解什么是错误的以及我需要做些什么来获得我的修改后的机器人应用程序&amp;它的模型正在运行?
所有帮助非常感谢!!谢谢!!