Django installed_apps does not recognise my app?

匿名 (未验证) 提交于 2019-12-03 01:36:02

问题:

This is my installed apps section in settings.py.

INSTALLED_APPS = [     'django.contrib.admin',     'django.contrib.auth',     'django.contrib.contenttypes',     'django.contrib.sessions',     'django.contrib.messages',     'django.contrib.staticfiles',     'homepage.apps.HomepageConfig', . . . ] 

My app name is "homepage" and I really can't remember why I changed it to 'homepage.apps.HomepageConfig', but whatever it is, it worked on my machine.

Now, i uploaded my files to server, installed required apps, did the migrations, but i noticed django does not create my "homepage" app table and does not migrate anything from my app. And my website returns the error: table homepage_post does not exist.

What is wrong?

回答1:

Check if in homepage app directory You have file named __init__.py and apps.py. The content of apps.py should be:

from django.apps import AppConfig  class HomepageConfig(AppConfig):     name = 'homepage' 


易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!