ModuleNotFoundError: No module named 'debug_toolbar' Django 3.1 - python

I'm facing a "common" problem apparently as I searched and found several topics about it. None of the answer provided worked for me as I already did everything mentionned.
I setup the virtualenv
Then, I installed django-degub-toolbar
pip install django-debug-toolbar
Add the application in the settings
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
# External apps
'debug_toolbar',
# Internal apps
...,
]
And edited the middleware
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
# Django Toolbar interaction with the middleware
'debug_toolbar.middleware.DebugToolbarMiddleware',
]
But nothing worked and I still got the error when I run the server.
Traceback
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/Users/saiko-san/Documents/app-mangas-collection/venv/lib/python3.7/site-packages/django/core/servers/basehttp.py", line 45, in get_internal_wsgi_application
return import_string(app_path)
File "/Users/saiko-san/Documents/app-mangas-collection/venv/lib/python3.7/site-packages/django/utils/module_loading.py", line 17, in import_string
module = import_module(module_path)
File "/Library/Frameworks/Python.framework/Versions/3.7/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 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 "/Users/saiko-san/Documents/app-mangas-collection/mangas_collection/mangas_collection/wsgi.py", line 16, in <module>
application = get_wsgi_application()
File "/Users/saiko-san/Documents/app-mangas-collection/venv/lib/python3.7/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application
return WSGIHandler()
File "/Users/saiko-san/Documents/app-mangas-collection/venv/lib/python3.7/site-packages/django/core/handlers/wsgi.py", line 127, in __init__
self.load_middleware()
File "/Users/saiko-san/Documents/app-mangas-collection/venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 40, in load_middleware
middleware = import_string(middleware_path)
File "/Users/saiko-san/Documents/app-mangas-collection/venv/lib/python3.7/site-packages/django/utils/module_loading.py", line 17, in import_string
module = import_module(module_path)
File "/Library/Frameworks/Python.framework/Versions/3.7/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 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'debug_toolbar'

Have you activate your virtual environment.?
if not please activate first with the command pipenv shell

Related

django.core.exceptions.ImproperlyConfigured: WSGI application 'DjBlog.wsgi.application' could not be loaded; Error importing module

I started a website building project with Django, but ran into a problem with the WSGI server and but I haven't change anything
Please, anyone who knows the answer, let me know.
This is the code that I wrote
settings.py
INSTALLED_APPS = [
# 'django.contrib.admin',
'django.contrib.admin.apps.SimpleAdminConfig',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'django.contrib.sitemaps',
'mdeditor',
'haystack',
'blog',
'accounts',
'comments',
'oauth',
'servermanager',
'owntracks',
'compressor',
# 'corsheader',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'corsheader.middleware.CorsMiddleware',
'django.middleware.gzip.GZipMiddleware',
'corsheaders.middleware.CorsMiddleware',
# 'debug_toolbar.middleware.DebugToolbarMiddleware',
'django.middleware.cache.UpdateCacheMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.cache.FetchFromCacheMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.http.ConditionalGetMiddleware',
'blog.middleware.OnlineMiddleware'
]
ROOT_URLCONF = 'DjBlog.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'blog.context_processors.seo_processor'
],
},
},
]
WSGI_APPLICATION = 'DjBlog.wsgi.application'
wsgi.py
"""
WSGI config for DjBlog 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/1.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_project.settings')
application = get_wsgi_application()
the eror
Traceback (most recent call last):
File "D:\DjangoBlog\venv\lib\site-packages\django\core\servers\basehttp.py", line 45, in get_internal_wsgi_application
return import_string(app_path)
File "D:\DjangoBlog\venv\lib\site-packages\django\utils\module_loading.py", line 17, in import_string
module = import_module(module_path)
File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 790, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "D:\DjangoBlog\DjBlog\wsgi.py", line 17, in <module>
application = get_wsgi_application()
File "D:\DjangoBlog\venv\lib\site-packages\django\core\wsgi.py", line 13, in get_wsgi_application
return WSGIHandler()
File "D:\DjangoBlog\venv\lib\site-packages\django\core\handlers\wsgi.py", line 127, in __init__
self.load_middleware()
File "D:\DjangoBlog\venv\lib\site-packages\django\core\handlers\base.py", line 40, in load_middleware
middleware = import_string(middleware_path)
File "D:\DjangoBlog\venv\lib\site-packages\django\utils\module_loading.py", line 17, in import_string
module = import_module(module_path)
File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'corsheader'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\threading.py", line 950, in _bootstrap_inner
self.run()
File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\threading.py", line 888, in run
self._target(*self._args, **self._kwargs)
File "D:\DjangoBlog\venv\lib\site-packages\django\utils\autoreload.py", line 53, in wrapper
(venv) D:\DjangoBlog>py manage.py runserver
Watching for file changes with StatReloader
[2020-10-07 16:08:24,084] INFO [django.utils.autoreload.run_with_reloader:613 autoreload] Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
October 07, 2020 - 16:08:26
Django version 3.1.2, using settings 'DjBlog.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
Exception in thread django-main-thread:
Traceback (most recent call last):
File "D:\DjangoBlog\venv\lib\site-packages\django\core\servers\basehttp.py", line 45, in get_internal_wsgi_application
return import_string(app_path)
File "D:\DjangoBlog\venv\lib\site-packages\django\utils\module_loading.py", line 17, in import_string
module = import_module(module_path)
File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 790, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "D:\DjangoBlog\DjBlog\wsgi.py", line 17, in <module>
application = get_wsgi_application()
File "D:\DjangoBlog\venv\lib\site-packages\django\core\wsgi.py", line 13, in get_wsgi_application
return WSGIHandler()
File "D:\DjangoBlog\venv\lib\site-packages\django\core\handlers\wsgi.py", line 127, in __init__
self.load_middleware()
File "D:\DjangoBlog\venv\lib\site-packages\django\core\handlers\base.py", line 40, in load_middleware
middleware = import_string(middleware_path)
File "D:\DjangoBlog\venv\lib\site-packages\django\utils\module_loading.py", line 17, in import_string
module = import_module(module_path)
File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'corsheader'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\threading.py", line 950, in _bootstrap_inner
self.run()
File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\threading.py", line 888, in run
self._target(*self._args, **self._kwargs)
File "D:\DjangoBlog\venv\lib\site-packages\django\utils\autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "D:\DjangoBlog\venv\lib\site-packages\django\core\management\commands\runserver.py", line 138, in inner_run
handler = self.get_handler(*args, **options)
File "D:\DjangoBlog\venv\lib\site-packages\django\contrib\staticfiles\management\commands\runserver.py", line 27, in get_handler
handler = super().get_handler(*args, **options)
File "D:\DjangoBlog\venv\lib\site-packages\django\core\management\commands\runserver.py", line 65, in get_handler
return get_internal_wsgi_application()
File "D:\DjangoBlog\venv\lib\site-packages\django\core\servers\basehttp.py", line 47, in get_internal_wsgi_application
raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: WSGI application 'DjBlog.wsgi.application' could not be loaded; Error importing module.
I have searched and tried many ways, but I could not find the right one.
Change django_project.settings with DjBlog.settings in your wsgi.py file.
Then follow the below steps to overcome ModuleNotFoundError.
Step 1: Install the app django-cors-headers
pip install django-cors-headers
Step 2: Add corsheader to the Installed App list in settings.py
INSTALLED_APPS = [
...
'corsheaders',
...
]
Step 3: Add CorsMiddleware and CommonMiddleware to middleware list in settings.py
MIDDLEWARE = [
...
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
...
]
Step 4: Allow access to all domains by just Adding the following variables in settings.py:
ALLOWED_HOSTS=['*']
CORS_ORIGIN_ALLOW_ALL = True
For more: https://dzone.com/articles/how-to-fix-django-cors-error
In your wsgi.py replace:
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_project.settings')
with:
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'DjBlog.settings').
I was also facing same issue (File "<frozen importlib._bootstrap>")
Solution:
python manage.py migrate
python manage.py collectstatic (if static required in your project).
After executing the above command, we could run the project successfully.

ModuleNotFoundError: No module named 'paypal'

I'm using,
Python: 3.8,
Django: 3.0,
django-paypal: 1.0.0
I'm trying to implement a simple Payment Gateway using Django-Paypal lib.
And I'm getting this error during the migration.....
(project-venv) PS J:\jaimin (E)\Programming Practice\Django\Payment Gateway using Paypal\simple_ecommerce\django_project> py -3 .\manage.py migrate
Traceback (most recent call last):
File ".\manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\jaimi\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
utility.execute()
File "C:\Users\jaimi\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\__init__.py", line 377, in execute
django.setup()
File "C:\Users\jaimi\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\jaimi\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\apps\registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "C:\Users\jaimi\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\apps\config.py", line 116, in create
mod = import_module(mod_path)
File "C:\Users\jaimi\AppData\Local\Programs\Python\Python38-32\lib\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 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'paypal'
And here is my settings.py
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'ecommerce_app',
'paypal.standard.ipn',
]
What can I do Now?.....
it is happening because of circular import in init.py file
follow the steps :
don't install this ...maybe u have done it ...
pip uninstall paypal
no need to delete migrations unistall it and reinstall it properly
pip install django-paypal
don't forget to add " - " in that because this is the reason for that issue ...
this worked for me !
try and give a upvote if works . Thank You in advance
You just need to install django-paypal.
pip install django-paypal

Django: No module named 'project'

I was working on a Django project on my personal laptop. Then I cloned the project to my work laptop and I'm getting a very weird error when I try to run any command, such as python manage.py runserver:
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 "/Users/jmetz/github/personal/golf-swings-api/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/Users/jmetz/github/personal/golf-swings-api/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/jmetz/github/personal/golf-swings-api/venv/lib/python3.7/site-packages/django/core/management/base.py", line 336, in run_from_argv
connections.close_all()
File "/Users/jmetz/github/personal/golf-swings-api/venv/lib/python3.7/site-packages/django/db/utils.py", line 219, in close_all
for alias in self:
File "/Users/jmetz/github/personal/golf-swings-api/venv/lib/python3.7/site-packages/django/db/utils.py", line 213, in __iter__
return iter(self.databases)
File "/Users/jmetz/github/personal/golf-swings-api/venv/lib/python3.7/site-packages/django/utils/functional.py", line 80, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/Users/jmetz/github/personal/golf-swings-api/venv/lib/python3.7/site-packages/django/db/utils.py", line 147, in databases
self._databases = settings.DATABASES
File "/Users/jmetz/github/personal/golf-swings-api/venv/lib/python3.7/site-packages/django/conf/__init__.py", line 79, in __getattr__
self._setup(name)
File "/Users/jmetz/github/personal/golf-swings-api/venv/lib/python3.7/site-packages/django/conf/__init__.py", line 66, in _setup
self._wrapped = Settings(settings_module)
File "/Users/jmetz/github/personal/golf-swings-api/venv/lib/python3.7/site-packages/django/conf/__init__.py", line 157, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/Users/jmetz/miniconda3/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 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'project'
Any idea what the issue is?
Add project to your INSTALLED_APPS in settings.py file
settings.py
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'project',
]
My solution to a similar problem was to export PYTHONPATH into my shell. That was throwing a warning about project, even though the INSTALLED_APPS was correct.

django oscar AppNotFoundError

Im following this tutorial step by step:
http://django-oscar.readthedocs.org/en/releases-1.1/internals/getting_started.html#install-oscar-and-its-dependencies
the thing is when I run the server locally and connect to localhost:8000, I just get this error
Traceback (most recent call last):
File "/usr/lib64/python3.5/wsgiref/handlers.py", line 137, in run
self.result = application(self.environ, self.start_response)
File "/home/hit/projects/quesos/oscar/lib/python3.5/site-packages/django/contrib/staticfiles/handlers.py", line 63, in __call__
return self.application(environ, start_response)
File "/home/hit/projects/quesos/oscar/lib/python3.5/site-packages/django/core/handlers/wsgi.py", line 170, in __call__
self.load_middleware()
File "/home/hit/projects/quesos/oscar/lib/python3.5/site-packages/django/core/handlers/base.py", line 50, in load_middleware
mw_class = import_string(middleware_path)
File "/home/hit/projects/quesos/oscar/lib/python3.5/site-packages/django/utils/module_loading.py", line 26, in import_string
module = import_module(module_path)
File "/home/hit/projects/quesos/oscar/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 662, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/home/hit/projects/quesos/oscar/lib/python3.5/site-packages/oscar/apps/basket/middleware.py", line 8, in <module>
Applicator = get_class('offer.utils', 'Applicator')
File "/home/hit/projects/quesos/oscar/lib/python3.5/site-packages/oscar/core/loading.py", line 29, in get_class
return get_classes(module_label, [classname])[0]
File "/home/hit/projects/quesos/oscar/lib/python3.5/site-packages/oscar/core/loading.py", line 91, in get_classes
installed_apps_entry, app_name = _find_installed_apps_entry(module_label)
File "/home/hit/projects/quesos/oscar/lib/python3.5/site-packages/oscar/core/loading.py", line 197, in _find_installed_apps_entry
"Couldn't find an app to import %s from" % module_label)
oscar.core.exceptions.AppNotFoundError: Couldn't find an app to import offer.utils from
I'm not sure how to make it work. Can any one help?
Thanks.
You have to append Oscar’s core apps to the installed apps, for example:
from oscar import get_core_apps
INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.flatpages',
...
'compressor',
'widget_tweaks',
] + get_core_apps()

Python 3.3 + Django 1.6 + Connector/Python Django Backend + South

I want to use this set: Ubuntu 12.04 + Python 3.3 + Django 1.6 + MySQL 5.5;
For support MySQL i used "Connector/Python Django Backend" (link).
My settings:
DATABASES = {
'default': {
'NAME': 'test',
'ENGINE': 'mysql.connector.django',
'USER': 'root',
'PASSWORD': '****',
'OPTIONS': {
'autocommit': True,
},
}
}
This is work.
But yet i want to use "South". I successfully installed "South".
pip install south==0.8.4
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'south',
)
Here's what happened
python manage.py syncdb
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/mikhail/virtualenv/python3.3/lib/python3.3/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/home/mikhail/virtualenv/python3.3/lib/python3.3/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/mikhail/virtualenv/python3.3/lib/python3.3/site-packages/django/core/management/__init__.py", line 272, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/home/mikhail/virtualenv/python3.3/lib/python3.3/site-packages/django/core/management/__init__.py", line 75, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/home/mikhail/virtualenv/python3.3/lib/python3.3/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
File "<frozen importlib._bootstrap>", line 1512, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 584, in _check_name_wrapper
File "<frozen importlib._bootstrap>", line 1022, in load_module
File "<frozen importlib._bootstrap>", line 1003, in load_module
File "<frozen importlib._bootstrap>", line 560, in module_for_loader_wrapper
File "<frozen importlib._bootstrap>", line 868, in _load_module
File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
File "/home/mikhail/virtualenv/python3.3/lib/python3.3/site-packages/south/management/commands/__init__.py", line 13, in <module>
from south.management.commands.syncdb import Command as SyncCommand
File "/home/mikhail/virtualenv/python3.3/lib/python3.3/site-packages/south/management/commands/syncdb.py", line 19, in <module>
from south.db import dbs
File "/home/mikhail/virtualenv/python3.3/lib/python3.3/site-packages/south/db/__init__.py", line 83, in <module>
db = dbs[DEFAULT_DB_ALIAS]
KeyError: 'default'
What to do?
To support the MySQL need to use MySQL-for-Python-3 (link)
Install:
$ tar xfz MySQL-python-1.2.1.tar.gz
$ cd MySQL-python-1.2.1
$ python setup.py build
$ sudo python setup.py install
Next on the official Django manual.

Categories