求解RuntimeError的问题
来源:7-10 drf实现发送短信验证码接口-2
燚x
2018-01-02
Unhandled exception in thread started by <_pydev_bundle.pydev_monkey._NewThreadStartupWithTrace object at 0x000001A4B427BD68> Traceback (most recent call last): File "F:\软件\PyCharm 2017.3\helpers\pydev\_pydev_bundle\pydev_monkey.py", line 589, in __call__ return self.original_func(*self.args, **self.kwargs) File "F:\django\VueShop\lib\site-packages\django\utils\autoreload.py", line 227, in wrapper fn(*args, **kwargs) File "F:\django\VueShop\lib\site-packages\django\core\management\commands\runserver.py", line 125, in inner_run self.check(display_num_errors=True) File "F:\django\VueShop\lib\site-packages\django\core\management\base.py", line 359, in check include_deployment_checks=include_deployment_checks, File "F:\django\VueShop\lib\site-packages\django\core\management\base.py", line 346, in _run_checks return checks.run_checks(**kwargs) File "F:\django\VueShop\lib\site-packages\django\core\checks\registry.py", line 81, in run_checks new_errors = check(app_configs=app_configs) File "F:\django\VueShop\lib\site-packages\django\core\checks\urls.py", line 16, in check_url_config return check_resolver(resolver) File "F:\django\VueShop\lib\site-packages\django\core\checks\urls.py", line 26, in check_resolver return check_method() File "F:\django\VueShop\lib\site-packages\django\urls\resolvers.py", line 254, in check for pattern in self.url_patterns: File "F:\django\VueShop\lib\site-packages\django\utils\functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "F:\django\VueShop\lib\site-packages\django\urls\resolvers.py", line 405, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "F:\django\VueShop\lib\site-packages\django\utils\functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "F:\django\VueShop\lib\site-packages\django\urls\resolvers.py", line 398, in urlconf_module return import_module(self.urlconf_name) File "F:\django\VueShop\lib\importlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 978, in _gcd_import File "<frozen importlib._bootstrap>", line 961, in _find_and_load File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 655, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 678, in exec_module File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed File "F:/django/shop\shop\urls.py", line 27, in <module> from users.views import SmsCodeViewset File "F:\django\shop\apps\users\views.py", line 13, in <module> from .serializers import SmsSerializer,UserRegSerializer File "F:\django\shop\apps\users\serializers.py", line 6, in <module> from .models import VerifyCode File "F:\django\shop\apps\users\models.py", line 9, in <module> class UserProfile(AbstractUser): File "F:\django\VueShop\lib\site-packages\django\db\models\base.py", line 118, in __new__ "INSTALLED_APPS." % (module, name) RuntimeError: Model class users.models.UserProfile doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
我的INSTALLED_APPS的配置和视频一致 求问怎么解决
INSTALLED_APPS = [ 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'users.apps.UsersConfig', 'DjangoUeditor', 'goods.apps.GoodsConfig', 'trade.apps.TradeConfig', 'user_operation.apps.UserOperationConfig', 'crispy_forms', 'django_filters', 'xadmin', 'rest_framework', 'corsheaders', 'rest_framework.authtoken' ]
写回答
3回答
-
月晴星飞
2018-01-16
已解决,修改apps/users/apps的name="apps/users". ==> "users"
032018-08-15 -
月晴星飞
2018-01-16
我也报一样的错误,请问怎么解决的
00 -
bobby
2018-01-05
你通过qq群找到我 给我发个qq消息我看看
00
Python前后端分离开发Vue+Django REST framework实战
Django REST framework课程视频,RESTFul API前后端分离开发
2873 学习 · 2457 问题
相似问题