I want to use allauth in django API but when I installed it I got some errors I fixed it by django.setup() and after that, I get the error which tells me that I have to set DJANGO_SETTINGS_MODULE now I did that in manage.py:
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
import django
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'website.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)
if __name__ == '__main__':
os.environ['DJANGO_SETTINGS_MODULE'] = 'website.settings'
django.setup()
main()
but I get this Traceback:
Traceback (most recent call last):
File "manage.py", line 23, in <module>
django.setup()
File "/home/abdelhamedabdin/.local/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/abdelhamedabdin/.local/lib/python3.8/site-packages/django/apps/registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "/home/abdelhamedabdin/.local/lib/python3.8/site-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'allauth'
please can anyone tells me how can I fix that exception error? I did many searches but I get no help and I asked here but also I got no help so, please if anyone can help me!
Additional information:
that is what I did in settings.py after I installed allauth by pip3
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.sites',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.account.auth_backends.AuthenticationBackend',
'index.apps.IndexConfig',
'account.apps.AccountConfig',
'community.apps.CommunityConfig',
]
AUTHENTICATION_BACKENDS = (
"django.contrib.auth.backends.ModelBackend",
"allauth.account.auth_backends.AuthenticationBackend",
)
SITE_ID = 1
and in urls.py
path('accounts/', include('allauth.urls')),
Edit post:
by using virtualenv that Trace has raised:
Traceback (most recent call last):
File "manage.py", line 23, in <module>
django.setup()
File "/media/abdelhamedabdin/BE4C6BE74C6B98C3/Cources/Django/all git/ripo/website/venv/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/media/abdelhamedabdin/BE4C6BE74C6B98C3/Cources/Django/all git/ripo/website/venv/lib/python3.8/site-packages/django/apps/registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "/media/abdelhamedabdin/BE4C6BE74C6B98C3/Cources/Django/all git/ripo/website/venv/lib/python3.8/site-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/media/abdelhamedabdin/BE4C6BE74C6B98C3/Cources/Django/all git/ripo/website/venv/lib/python3.8/site-packages/allauth/account/auth_backends.py", line 3, in <module>
from django.contrib.auth.backends import ModelBackend
File "/media/abdelhamedabdin/BE4C6BE74C6B98C3/Cources/Django/all git/ripo/website/venv/lib/python3.8/site-packages/django/contrib/auth/backends.py", line 5, in <module>
from django.contrib.auth.models import Permission
File "/media/abdelhamedabdin/BE4C6BE74C6B98C3/Cources/Django/all git/ripo/website/venv/lib/python3.8/site-packages/django/contrib/auth/models.py", line 2, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "/media/abdelhamedabdin/BE4C6BE74C6B98C3/Cources/Django/all git/ripo/website/venv/lib/python3.8/site-packages/django/contrib/auth/base_user.py", line 47, in <module>
class AbstractBaseUser(models.Model):
File "/media/abdelhamedabdin/BE4C6BE74C6B98C3/Cources/Django/all git/ripo/website/venv/lib/python3.8/site-packages/django/db/models/base.py", line 107, in __new__
app_config = apps.get_containing_app_config(module)
File "/media/abdelhamedabdin/BE4C6BE74C6B98C3/Cources/Django/all git/ripo/website/venv/lib/python3.8/site-packages/django/apps/registry.py", line 252, in get_containing_app_config
self.check_apps_ready()
File "/media/abdelhamedabdin/BE4C6BE74C6B98C3/Cources/Django/all git/ripo/website/venv/lib/python3.8/site-packages/django/apps/registry.py", line 135, in check_apps_ready
raise AppRegistryNotReady("Apps aren't loaded yet.")
By installing django-allauth as follows:
python -m pip install django-allauth
I solved my problem and the main problem was spin around allauth.account that I want to migrate it into INSTALLED_APPS also, I had an additional app in this case, 'allauth.account.auth_backends.AuthenticationBackend', those apps was the reason for the problems.
for the first app (allauth.account.auth_backends.AuthenticationBackend)I was getting an error that tells me that I am not able to migrate the INSTALLED_APPS without migrating allauth app first.
for the second app (allauth.account) I was getting an error duplicate 'account' because I have already application with that name so, I had to rename the app name which already exists to name like accounts for example until I can install allauth.account succeeded.
until I am able to specify one error of each app I was migrating each one separately to show the specific error to it but when I was migrating the both together I was getting that Traceback I specified above.
Related
I know others have had a similar issues with and getting this same error, but I think my situation is unique.
I am running Django 3.1.4 and on my local machine, I can run python manage.py shell with no issue.
On the server instance, running what should be the same project, and the same version of Django, I get:
Django ImportError: cannot import name 'python_2_unicode_compatible'
from 'django.utils.encoding'
When trying to run manage.py shell. To make things more cryptic, if I open the shell on my local machine and run:
from django.utils.encoding import python_2_unicode_compatible
I get the same error. So for some reason when I call manage.py shell from my local machine it doesn't try to import python_2_unicode_compatible, but when I run it from the server it does. I can't find where the discrepancy is.
Here is the full stacktrace if that is helpful:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/chase/Env/mantis/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/home/chase/Env/mantis/lib/python3.8/site-packages/django/core/management/__init__.py", line 377, in execute
django.setup()
File "/home/chase/Env/mantis/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/chase/Env/mantis/lib/python3.8/site-packages/django/apps/registry.py", line 114, in populate
app_config.import_models()
File "/home/chase/Env/mantis/lib/python3.8/site-packages/django/apps/config.py", line 211, in import_models
self.models_module = import_module(models_module_name)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 848, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/chase/Env/mantis/lib/python3.8/site-packages/request/models.py", line 7, in <module>
from django.utils.encoding import python_2_unicode_compatible
ImportError: cannot import name 'python_2_unicode_compatible' from 'django.utils.encoding' (/home/chase/Env/mantis/lib/python3.8/site-packages/django/utils/encoding.py)
Any ideas on where to start poking around?
You can try this.
First, install six:
pip install six
Then go to the django.utils.encoding.py file and simply import python_2_unicode_compatible from six like this:
from six import python_2_unicode_compatible
I have a problem with Django and wsgi that I cannot pinpoint. The app works fine on my local test server and it also works fine on a local apache WAMP setup (without any venvs). When deploying it to our Linux server again the local test server runs (as does makemigrations, migrate or check):
python3 manage.py runserver
/home/www-test/myapp-venv/lib/python3.7/site-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.25.8) or chardet (2.0.3) doesn't match a supported version!
RequestsDependencyWarning)
/home/www-test/myapp-venv/lib/python3.7/site-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.25.8) or chardet (2.0.3) doesn't match a supported version!
RequestsDependencyWarning)
Performing system checks...
System check identified no issues (0 silenced).
March 18, 2020 - 16:22:20
Django version 2.2.11, using settings 'myapp.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
python3 manage.py check
/home/www-test/myapp-venv/lib/python3.7/site-packages/requests/__init__.py:91:
RequestsDependencyWarning: urllib3 (1.25.8) or chardet (2.0.3) doesn't match a supported version!
RequestsDependencyWarning)
System check identified no issues (0 silenced).
However when I try to deploy it with wsgi/Apache on the Linux machine I get
Traceback (most recent call last):
File "myapp/wsgi.py", line 20, in <module>
application = get_wsgi_application()
File "/home/www-test/.local/lib/python3.7/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
django.setup(set_prefix=False)
File "/home/www-test/.local/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/www-test/.local/lib/python3.7/site-packages/django/apps/registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "/home/www-test/.local/lib/python3.7/site-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/www-test/myapp/myapp/maintenance.py", line 9, in <module>
from imageplus.models import ImagePlus
File "/home/www-test/myapp/imageplus/models.py", line 6, in <module>
from userprofile.models import Userprofile
File "/home/www-test/myapp/userprofile/models.py", line 5, in <module>
from django.contrib.auth.models import User
File "/home/www-test/.local/lib/python3.7/site-packages/django/contrib/auth/models.py", line 2, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "/home/www-test/.local/lib/python3.7/site-packages/django/contrib/auth/base_user.py", line 47, in <module>
class AbstractBaseUser(models.Model):
File "/home/www-test/.local/lib/python3.7/site-packages/django/db/models/base.py", line 103, in __new__
app_config = apps.get_containing_app_config(module)
File "/home/www-test/.local/lib/python3.7/site-packages/django/apps/registry.py", line 252, in get_containing_app_config
self.check_apps_ready()
File "/home/www-test/.local/lib/python3.7/site-packages/django/apps/registry.py", line 135, in check_apps_ready
raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
I suspect it has something to do with venv or with missing paths, but I don't know where to start. wsgi.py looks like this:
"""
WSGI config for myapp project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
"""
import os, sys
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myapp.settings')
sys.path.append('/home/www-test/myapp/myapp')
sys.path.append('/home/www-test/myapp')
sys.path.append('/home/www-test/myapp-venv/lib/python3.7/site-packages')
application = get_wsgi_application()
Any suggestions a to where to even start with hunting this error would be very much appreciated.
[edit:]
I traced the error further to apps.py of myapp which looks like this:
from django.apps import AppConfig
from threading import Thread
from django.utils import timezone
import time
import schedule
import os
from decouple import config
class SebastianConfig(AppConfig):
name = 'myapp'
def ready(self):
if os.environ.get('RUN_MAIN', None) == 'true':
return
import myapp.signals
if config('AUTOMAINTENANCE', cast=bool)==False:
print ('[myApp]: auto maintenance is disabled')
return
from myapp.maintenance import maintenance
def scheduler_demon():
while True:
schedule.run_pending()
time.sleep(60)
def aliveping():
print(f'[myApp]:ping {timezone.now()}')
schedule.every(5).minutes.do(aliveping)
schedule.every(24).hours.do(maintenance)
schedule.run_all()
worker=Thread(target=scheduler_demon,args=(),)
worker.daemon=True
worker.start()
In theory this should not cause problems as fas as my understanding of Django goes. Its also the ONLY spot maintenance is imported.
Now the funny thing is I removed that passage and wsgi worked like a charm. I added the passage once again and SURPRISE it still works like a charm?!!?
First, I might want to mention I'm a beginner with Django. I'm trying to install Django-Invitations on my app to send sign up invitations. I followed their README instructions.
pip install django-invitations
# Add to settings.py, INSTALLED_APPS
'invitations',
# Append to urls.py
url(r'^invitations/', include('invitations.urls', namespace='invitations')),
# Run migrations
python manage.py migrate
I also pip installed all the requirements from their requirements file:
coverage==4.5.4
flake8==3.7.9
freezegun==0.3.12
mock==3.0.5
pytest==5.2.2
pytest-django==3.6.0
pytest-cov==2.8.1
tox==3.14.0
But I keep getting the same error when I run migrations for the first time:
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "C:\Users\maxim\Desktop\Web Development\Projects\admin\RentQ3\myEnv\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
utility.execute()
File "C:\Users\maxim\Desktop\Web Development\Projects\admin\RentQ3\myEnv\lib\site-packages\django\core\management\__init__.py", line 377, in execute
django.setup()
File "C:\Users\maxim\Desktop\Web Development\Projects\admin\RentQ3\myEnv\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\maxim\Desktop\Web Development\Projects\admin\RentQ3\myEnv\lib\site-packages\django\apps\registry.py", line 114, in populate
app_config.import_models()
File "C:\Users\maxim\Desktop\Web Development\Projects\admin\RentQ3\myEnv\lib\site-packages\django\apps\config.py", line 211, in import_models
self.models_module = import_module(models_module_name)
File "C:\Users\maxim\AppData\Local\Programs\Python\Python36-32\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 "C:\Users\maxim\Desktop\Web Development\Projects\admin\RentQ3\myEnv\lib\site-packages\invitations\models.py", line 12, in <module>
from django.utils.encoding import python_2_unicode_compatible
ImportError: cannot import name 'python_2_unicode_compatible'
Any idea what the issue might be?
Thanks!
It should work if you install six.
All you then need to do is replace django.utils.encoding with six in your models.py.
I am trying to implement django-freeradius, but I get the error cannot import name 'ReadOnlyAdmin', when I write the line * in urlspatters within urls.py of my project. I have tried to use the same configuration in https://github.com/openwisp/django-freeradius/blob/master/tests/urls.py, but it does not work.
# myproject/urls.py
from django.contrib import admin
from django.urls import path, include
from openwisp_utils.admin_theme.admin import admin, openwisp_admin
openwisp_admin()
admin.autodiscover()
urlpatterns = [
url(r'^', include('django_freeradius.urls', namespace='freeradius')), #* This line
path('admin/', admin.site.urls),
]
I have installed:
Python 3.6.8
Django 2.2.4
django-filter 2.1.0
django-freeradius 0.1a0
openwisp-utils 0.2.2
These are my apps in settings.py
# myproject/settings.py
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django_freeradius',
'django_filters',
]
And, this is the complete error when I run python manage.py runserver ()
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/mnt/c/Users/myuser/Documents/python/hotspot/env/lib/python3.6/site-packages/django/utils/autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "/mnt/c/Users/myuser/Documents/python/hotspot/env/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "/mnt/c/Users/myuser/Documents/python/hotspot/env/lib/python3.6/site-packages/django/utils/autoreload.py", line 77, in raise_last_exception
raise _exception[1]
File "/mnt/c/Users/myuser/Documents/python/hotspot/env/lib/python3.6/site-packages/django/core/management/__init__.py", line 337, in execute
autoreload.check_errors(django.setup)()
File "/mnt/c/Users/myuser/Documents/python/hotspot/env/lib/python3.6/site-packages/django/utils/autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "/mnt/c/Users/myuser/Documents/python/hotspot/env/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/mnt/c/Users/myuser/Documents/python/hotspot/env/lib/python3.6/site-packages/django/apps/registry.py", line 122, in populate
app_config.ready()
File "/mnt/c/Users/myuser/Documents/python/hotspot/env/lib/python3.6/site-packages/django/contrib/admin/apps.py", line 24, in ready
self.module.autodiscover()
File "/mnt/c/Users/myuser/Documents/python/hotspot/env/lib/python3.6/site-packages/django/contrib/admin/__init__.py", line 26, in autodiscover
autodiscover_modules('admin', register_to=site)
File "/mnt/c/Users/myuser/Documents/python/hotspot/env/lib/python3.6/site-packages/django/utils/module_loading.py", line 47, in autodiscover_modules
import_module('%s.%s' % (app_config.name, module_to_search))
File "/mnt/c/Users/myuser/Documents/python/hotspot/env/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/mnt/c/Users/myuser/Documents/python/hotspot/env/src/django-freeradius/django_freeradius/admin.py", line 6, in <module>
from .base.admin import (
File "/mnt/c/Users/myuser/Documents/python/hotspot/env/src/django-freeradius/django_freeradius/base/admin.py", line 9, in <module>
from openwisp_utils.admin import ReadOnlyAdmin, TimeReadonlyAdminMixin
ImportError: cannot import name 'ReadOnlyAdmin'
I appreciate if someone could give me the reason of this error.
Try to install the development version of openwisp-utils:
pip install --upgrade http://github.com/openwisp/openwisp-utils/tarball/master
Django runserver is not work
python + SQL db. If I install sudo apt-get install python-mysqldb. Make migrate is okey, tables is create but runserver ERROR
Failed to get real commands on module "mysite": python process died with code 1: Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/django/db/backends/mysql/base.py", line 25, in <module>
import MySQLdb as Database
ImportError: No module named 'MySQLdb'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/ivan/pycharm-2016.3.2/helpers/pycharm/_jb_manage_tasks_provider.py", line 25, in <module>
django.setup()
File "/usr/local/lib/python3.5/dist-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python3.5/dist-packages/django/apps/registry.py", line 108, in populate
app_config.import_models(all_models)
File "/usr/local/lib/python3.5/dist-packages/django/apps/config.py", line 199, in import_models
self.models_module = import_module(models_module_name)
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 665, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/usr/local/lib/python3.5/dist-packages/django/contrib/auth/models.py", line 4, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "/usr/local/lib/python3.5/dist-packages/django/contrib/auth/base_user.py", line 52, in <module>
class AbstractBaseUser(models.Model):
File "/usr/local/lib/python3.5/dist-packages/django/db/models/base.py", line 119, in __new__
new_class.add_to_class('_meta', Options(meta, app_label))
Make sure you have PyMySQL module installed, if not use this.
pip install pymysql
In settings.py, add following code just below import os.
Your current code
import os
Your new code
import os
try:
import pymysql
pymysql.install_as_MySQLdb()
except:
pass