skip to Main Content

guys i puled my project from github and i installed all required packages but after makemigrations or runserver commands i get error like below.

tying to comment ‘social_auth‘ and social_django … and
command like python3 manage.py migrate --fake myprojectname zero

or

python3 manage.py migrate --fake social_auth zero

or reinstalling packages dont work for me any idea???

error :

.....

......

   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")

this is installed app

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',

]

requirment file:

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

2

Answers


  1. What worked for me is, on an empty database after deleting files from migrations folder except init.py:

    1. Go to projects urls.py and comment out all the paths
    2. run python manage.py migrate auth
    3. Undo changes to urls.py
    4. run python manage.py makemigrations
    5. run python manage.py migrate
    Login or Signup to reply.
  2. u need to paste all error log for analysis as below.

    ...
      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")
    
    ...
    

    i found we cannot use some object as [__users_in_group = Group.objects.get(name=__app_group_name).user_set.all()] out the function. And fixed this error after move this source to function.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search