djnago 11.1、python 2.7およびmongokit.iを使用してmongodbおよびsqlデータベースでdjangoのアプリケーションを作成しています。だから私は最初に私はSQLと私のアプリケーションは正常に実行に関するコーディングを行います。しかし、MongoDBのためにコード化した後、それは、このエラー表示される: - トラブルシューティングの十数時間後RuntimeError:モデルクラスmodels.AuthGroupは明示的なapp_labelを宣言せず、INSTALLED_APPSのアプリケーションにありません
を、おそらくより、私はビジネスで最終的だと思ったが、その後私が得た:
prompt-コマンド
(orahienv) [email protected]:~/Desktop/backup/admin_python$ python manage.py runserver
Performing system checks...
Unhandled exception in thread started by <function wrapper at 0x7fa8ce735de8>
Traceback (most recent call last):
File "/var/www/html/admin_python/orahienv/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 227, in wrapper
fn(*args, **kwargs)
File "/var/www/html/admin_python/orahienv/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 125, in inner_run
self.check(display_num_errors=True)
File "/var/www/html/admin_python/orahienv/local/lib/python2.7/site-packages/django/core/management/base.py", line 359, in check
include_deployment_checks=include_deployment_checks,
File "/var/www/html/admin_python/orahienv/local/lib/python2.7/site-packages/django/core/management/base.py", line 346, in _run_checks
return checks.run_checks(**kwargs)
File "/var/www/html/admin_python/orahienv/local/lib/python2.7/site-packages/django/core/checks/registry.py", line 81, in run_checks
new_errors = check(app_configs=app_configs)
File "/var/www/html/admin_python/orahienv/local/lib/python2.7/site-packages/django/core/checks/urls.py", line 16, in check_url_config
return check_resolver(resolver)
File "/var/www/html/admin_python/orahienv/local/lib/python2.7/site-packages/django/core/checks/urls.py", line 26, in check_resolver
return check_method()
File "/var/www/html/admin_python/orahienv/local/lib/python2.7/site-packages/django/urls/resolvers.py", line 254, in check
for pattern in self.url_patterns:
File "/var/www/html/admin_python/orahienv/local/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/var/www/html/admin_python/orahienv/local/lib/python2.7/site-packages/django/urls/resolvers.py", line 405, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/var/www/html/admin_python/orahienv/local/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/var/www/html/admin_python/orahienv/local/lib/python2.7/site-packages/django/urls/resolvers.py", line 398, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/somya/Desktop/backup/admin_python/admin_python/urls.py", line 21, in <module>
url(r'', include('admin_app.urls', namespace = 'admin_app')),
File "/var/www/html/admin_python/orahienv/local/lib/python2.7/site-packages/django/conf/urls/__init__.py", line 50, in include
urlconf_module = import_module(urlconf_module)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/somya/Desktop/backup/admin_python/admin_app/urls.py", line 26, in <module>
exec "from {0} import {1}".format(dir_name + files.split(".")[0], files.split(".")[0].title())
File "<string>", line 1, in <module>
File "/home/somya/Desktop/backup/admin_python/admin_app/views_cluster/Travel_Details.py", line 30, in <module>
from models import Location
File "/home/somya/Desktop/backup/admin_python/models.py", line 15, in <module>
class AuthGroup(models.Model):
File "/var/www/html/admin_python/orahienv/local/lib/python2.7/site-packages/django/db/models/base.py", line 118, in __new__
"INSTALLED_APPS." % (module, name)
RuntimeError: Model class models.AuthGroup doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
ウェブ上でこれに関する情報はほとんどありません。そこに解決策はありません。何かアドバイスは途方もなく
setting.py-
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'admin_app',
'celery',
admin_python/model.pyをいただければ幸いです -
from __future__ import unicode_literals
from django.db import models
from django.utils import timezone
from django.contrib.auth.signals import user_logged_in
import hashlib, os
from django.template.defaultfilters import default
from django.core.signals import setting_changed
from django.core.validators import MinValueValidator
import admin_python
import admin_app
from django.conf import settings
from django.contrib.auth.models import BaseUserManager
import string
import random
import datetime
from django_mongokit import connection
from django_mongokit.document import DjangoDocument
class Acsum(models.Model):
sum_from = models.IntegerField(blank=True, null=True)
sum_to = models.IntegerField(blank=True, null=True)
sum_date = models.DateTimeField(blank=True, null=True)
sum_amount = models.FloatField(blank=True, null=True)
sum_type = models.CharField(max_length=12, blank=True, null=True)
sum_reason = models.CharField(max_length=250, blank=True, null=True)
dd = models.IntegerField(db_column='ID', blank=True, null=True) # Field name made lowercase.
balance = models.CharField(max_length=100, blank=True, null=True)
tr_date = models.BigIntegerField(blank=True, null=True)
tr_month = models.BigIntegerField(blank=True, null=True)
tr_year = models.BigIntegerField(blank=True, null=True)
class Meta:
managed = False
db_table = 'acsum'
class Location(DjangoDocument):
collection_name = 'location'
__database__ = 'pom'
structure = {
'user_id':int,
'name':basestring,
'loc_lon': float,
'timestamp':datetime.datetime,
'activity':basestring,
'lot_lat':float,
'battery_status':basestring,
'address':basestring,
'date_created':datetime.datetime
}
use_dot_notation = True
あなたは 'INSTALLED_APPS' –
で' admin_python'含まれていないが、私のアプリ名が –
はまだウルの提案として、私は私のsetting.pyでadmin_pythonを追加し、それはまだ同じエラーを示している:( –