伙计们我从github那里购买了我的项目并安装了所有必需的软件包但是在makemigrations
或runserver
命令之后我得到了如下错误。
要发表评论' social_auth
'和social_django
...和
命令如python3 manage.py migrate --fake myprojectname zero
或
python3 manage.py migrate --fake social_auth zero
或重新安装包不适合我任何想法???
错误:
.....
......
db.query(q)
File "/home/mohammadreza/www/html/academy/uenv/lib/python3.6/site-packages/MySQLdb/connections.py", line 277, in query
_mysql.connection.query(self, query)
django.db.utils.ProgrammingError: (1146, "Table 'academy.auth_group' doesn't exist")
这是已安装的应用
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'corsheaders',
'rest_framework',
'rest_framework_jwt',
'rest_framework.authtoken',
'social_django',
'rest_social_auth',
'api.v1.blog',
'api.v1.store',
'api.v1.accounts',
'api.v1.manager',
]
要求文件:
amqp==2.2.2
appdirs==1.4.3
asn1crypto==0.24.0
billiard==3.5.0.3
cached-property==1.3.1
celery==4.1.0
certifi==2018.1.18
cffi==1.11.5
chardet==3.0.4
cryptography==2.1.4
cycler==0.10.0
defusedxml==0.5.0
Django==2.0.4
django-braces==1.12.0
django-cors-headers==2.1.0
django-filter==1.1.0
django-ranged-response==0.2.0
django-redis==4.9.0
djangorestframework==3.7.7
djangorestframework-jwt==1.11.0
gevent==1.2.2
greenlet==0.4.13
gunicorn==19.7.1
idna==2.6
isodate==0.6.0
kiwisolver==1.0.1
kombu==4.1.0
lxml==4.1.1
Markdown==2.6.11
matplotlib==2.2.2
mysqlclient==1.3.12
numpy==1.14.2
oauthlib==2.0.7
olefile==0.45.1
opencv-python==3.4.0.12
Pillow==4.1.1
pycparser==2.18
PyJWT==1.5.3
pyparsing==2.2.0
pytesseract==0.2.0
python-dateutil==2.7.2
python-memcached==1.59
python3-openid==3.1.0
pytz==2017.3
redis==2.10.6
requests==2.18.4
requests-oauthlib==0.8.0
requests-toolbelt==0.8.0
rest-social-auth==1.2.0
six==1.11.0
social-auth-app-django==1.2.0
social-auth-core==1.7.0
urllib3==1.22
vine==1.1.4
whitenoise==3.3.1
zeep==2.5.0
答案 0 :(得分:1)
对我有用的是,从迁移文件夹中删除除 init .py:
以外的文件之后,在空数据库上答案 1 :(得分:-1)
u需要粘贴所有错误日志以进行分析,如下所示。
...
File "/opt/xxx/src_schedule/urls.py", line 3, in <module>
from src_schedule import views
File "/opt/xxx/src_schedule/views.py", line 16, in <module>
__users_in_group = Group.objects.get(name=__app_group_name).user_set.all()
File "/opt/zzz/env3.6.8/lib/python3.6/site-packages/django/db/models/manager.py", line 82, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/opt/zzz/env3.6.8/lib/python3.6/site-packages/django/db/models/query.py", line 402, in get
num = len(clone)
File "/opt/zzz/env3.6.8/lib/python3.6/site-packages/django/db/models/query.py", line 256, in __len__
self._fetch_all()
File "/opt/zzz/env3.6.8/lib/python3.6/site-packages/django/db/models/query.py", line 1242, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "/opt/zzz/env3.6.8/lib/python3.6/site-packages/django/db/models/query.py", line 55, in __iter__
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
File "/opt/zzz/env3.6.8/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1100, in execute_sql
cursor.execute(sql, params)
File "/opt/zzz/env3.6.8/lib/python3.6/site-packages/django/db/backends/utils.py", line 99, in execute
return super().execute(sql, params)
File "/opt/zzz/env3.6.8/lib/python3.6/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/opt/zzz/env3.6.8/lib/python3.6/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/opt/zzz/env3.6.8/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/opt/zzz/env3.6.8/lib/python3.6/site-packages/django/db/utils.py", line 89, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/opt/zzz/env3.6.8/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/opt/zzz/env3.6.8/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 71, in execute
return self.cursor.execute(query, args)
File "/opt/zzz/env3.6.8/lib/python3.6/site-packages/MySQLdb/cursors.py", line 206, in execute
res = self._query(query)
File "/opt/zzz/env3.6.8/lib/python3.6/site-packages/MySQLdb/cursors.py", line 312, in _query
db.query(q)
File "/opt/zzz/env3.6.8/lib/python3.6/site-packages/MySQLdb/connections.py", line 224, in query
_mysql.connection.query(self, query)
django.db.utils.ProgrammingError: (1146, "Table 'auto_dev.auth_group' doesn't exist")
...
我发现我们无法使用某些对象,因为该函数中没有[__users_in_group = Group.objects.get(name = __ app_group_name).user_set.all()]。并在将此源移至功能后修复了该错误。