I've been trying to fix this Django issue. I've just started this project and I'm fairly new to this language so I don't know where exactly is the issue.
Error:
Traceback (most recent call last):
File "C:\Users\user\Desktop\Projects Python\Django\manage.py", line 22, in <module>
main()
File "C:\Users\user\Desktop\Projects Python\Django\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
utility.execute()
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\__init__.py", line 377, in execute
django.setup()
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\django\apps\registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\django\apps\config.py", line 90, in create
module = import_module(entry)
File "C:\Users\user\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 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'learning_logs'
models.py:
from django.db import models
# Create your models here.
class Topic(models.Model):
text = models.CharField(max_length=200)
date_added = models.DateTimeField(auto_now_add=True)
def __str__(self):
return self.text
settings.py:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'learning_logs',
]
Any help I would really appreciate it.
In settings.py, the Installed apps should be written as 'app_name.apps.appconfig'.
The 'appconfig' is the same as the class name in app/apps.py
In you case it might be something like learning_logs.apps.LearningLogsConfig
Related
I'm trying to modify Django's built-in authetnication system by adding a custom user model. The customized model is defined inside an app named accounts:
from django.db import models
from django.contrib.auth.models import AbstractUser
from django.conf import settings
# Create your models here.
COUNTRIES = settings.COUNTRY_CHOICES
class CustomUser(AbstractUser):
zip_code = models.PositiveSmallIntegerField(blank=True, null=True)
city = models.CharField(blank=True, null=True, max_length=64)
address_street = models.CharField(blank=True, null=True, max_length=64)
address_number = models.CharField(blank=True, null=True, max_length=32)
country = models.CharField(blank=True, null=True, choices=COUNTRIES, max_length=8)
I updated the settings.py file this way:
AUTH_USER_MODEL = accounts.CustomUser
I added accounts as an installed app:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'accounts',
'store',
'cart',
]
When I try to run the python manage.py makemigrations command in terminal to apply changes made to the user model Django's throwing this error:
Traceback (most recent call last):
File "C:\Users\uhlar\Dev\ecommerce\manage.py", line 22, in <module>
main()
File "C:\Users\uhlar\Dev\ecommerce\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\uhlar\.virtualenvs\ecommerce-vU6zMECh\lib\site-packages\django\core\management\__init__.py", line 446, in execute_from_command_line
utility.execute()
File "C:\Users\uhlar\.virtualenvs\ecommerce-vU6zMECh\lib\site-packages\django\core\management\__init__.py", line 386, in execute
settings.INSTALLED_APPS
File "C:\Users\uhlar\.virtualenvs\ecommerce-vU6zMECh\lib\site-packages\django\conf\__init__.py", line 87, in __getattr__
self._setup(name)
File "C:\Users\uhlar\.virtualenvs\ecommerce-vU6zMECh\lib\site-packages\django\conf\__init__.py", line 74, in _setup
self._wrapped = Settings(settings_module)
File "C:\Users\uhlar\.virtualenvs\ecommerce-vU6zMECh\lib\site-packages\django\conf\__init__.py", line 183, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Users\uhlar\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:\Users\uhlar\Dev\ecommerce\config\settings.py", line 149, in <module>
AUTH_USER_MODEL = accounts.CustomUser
NameError: name 'accounts' is not defined
The error is not only confined to the accounts app, no matter inside which app I try to define the CustomUser model I'm still getting it.
If anyone knows what's causing the problem please help me to resolve it.
The AUTH_USER_MODEL setting [Django-doc] should be a string, not a (qualified) name, so:
# settings.py
# …
# string literal 🖟 🖟
AUTH_USER_MODEL = 'accounts.CustomUser'
As Willem mentioned, you need to update your AUTH_USER_MODEL setting inside settings.py to accounts.CustomerUser model. In addition, you will have to update your schema manually as when you first run migrations, Django will use the default auth.User for multiple foreign keys etc. See the docs here for changing a user mid project.
I am using Django 2.
I am getting this error code, I have looked all over online and am not finding any answers to fix why it keeps giving me this error code.
Traceback (most recent call last):
File "/home/matthew/anaconda3/lib/python3.6/site-packages/django/utils/autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "/home/matthew/anaconda3/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run
self.check(display_num_errors=True)
File "/home/matthew/anaconda3/lib/python3.6/site-packages/django/core/management/base.py", line 379, in check
include_deployment_checks=include_deployment_checks,
File "/home/matthew/anaconda3/lib/python3.6/site-packages/django/core/management/base.py", line 366, in _run_checks
return checks.run_checks(**kwargs)
File "/home/matthew/anaconda3/lib/python3.6/site-packages/django/core/checks/registry.py", line 71, in run_checks
new_errors = check(app_configs=app_configs)
File "/home/matthew/anaconda3/lib/python3.6/site-packages/django/core/checks/urls.py", line 40, in check_url_namespaces_unique
all_namespaces = _load_all_namespaces(resolver)
File "/home/matthew/anaconda3/lib/python3.6/site-packages/django/core/checks/urls.py", line 57, in _load_all_namespaces
url_patterns = getattr(resolver, 'url_patterns', [])
File "/home/matthew/anaconda3/lib/python3.6/site-packages/django/utils/functional.py", line 37, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/matthew/anaconda3/lib/python3.6/site-packages/django/urls/resolvers.py", line 533, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/matthew/anaconda3/lib/python3.6/site-packages/django/utils/functional.py", line 37, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/matthew/anaconda3/lib/python3.6/site-packages/django/urls/resolvers.py", line 526, in urlconf_module
return import_module(self.urlconf_name)
File "/home/matthew/anaconda3/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 "/home/matthew/mykoio/mykoio/urls.py", line 21, in <module>
path('website/', include('website.urls')),
File "/home/matthew/anaconda3/lib/python3.6/site-packages/django/urls/conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "/home/matthew/anaconda3/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 "/home/matthew/mykoio/website/urls.py", line 3, in <module>
from . import views
File "/home/matthew/mykoio/website/views.py", line 6, in <module>
from django.contrib.auth.forms import UserCreationForm
File "/home/matthew/anaconda3/lib/python3.6/site-packages/django/contrib/auth/forms.py", line 10, in <module>
from django.contrib.auth.models import User
File "/home/matthew/anaconda3/lib/python3.6/site-packages/django/contrib/auth/models.py", line 3, in <module>
from django.contrib.contenttypes.models import ContentType
File "/home/matthew/anaconda3/lib/python3.6/site-packages/django/contrib/contenttypes/models.py", line 134, in <module>
class ContentType(models.Model):
File "/home/matthew/anaconda3/lib/python3.6/site-packages/django/db/models/base.py", line 95, in __new__
"INSTALLED_APPS." % (module, name)
RuntimeError: Model class django.contrib.contenttypes.models.ContentType doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
My installed apps are:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.auth.views',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
For some reason I have all the apps people are recommending, I try them and I get the same error code no matter what. All I can think now is there is something wrong with the Django code further in.
INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.auth.views', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'website', ]
this should work.
I'm new to django and I'm trying to extend the user class in one of my apps but I'm having trouble redirecting from setting.py to the model that contains my AbstractUser
My Nproject:
-apps:
--profile:
---__init__.py
---apps.py
---forms.py
---models.py
---urls.py
---views.py
--apps1
-media
-static
-templates
-Nproject:
--__init__.py
--settings.py
--urls.py
--wsgi.py
model in apps.profile.models
from django.db import models
from django.contrib.auth.models import AbstractUser
class User(AbstractUser):
address = models.CharField(max_length=255)
def __str__(self):
return '%s %s' % (self.email, self.username)
setting.py and here I think this is my mistake
AUTH_USER_MODEL = 'apps.User' #not working
I think the error is in AUTH_USER_MODEL that I do not know how to properly reference the model User
Research some sites and tell me that you should use the init.py file but it is not working
init in apps.profile
from .models import User
Error:
Traceback (most recent call last):
File "./manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/home/projects/.virtualenvs/Nproject/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
utility.execute()
File "/home/projects/.virtualenvs/Nproject/lib/python3.6/site-packages/django/core/management/__init__.py", line 347, in execute
django.setup()
File "/home/projects/.virtualenvs/Nproject/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/projects/.virtualenvs/Nproject/lib/python3.6/site-packages/django/apps/registry.py", line 89, in populate
app_config = AppConfig.create(entry)
File "/home/projects/.virtualenvs/Nproject/lib/python3.6/site-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/home/projects/.virtualenvs/Nproject/lib/python3.6/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 "/home/projects/Nproject/apps/perfil/__init__.py", line 1, in <module>
from .models import User
File "/home/projects/Nproject/apps/perfil/models.py", line 2, in <module>
from django.contrib.auth.models import User
File "/home/projects/.virtualenvs/Nproject/lib/python3.6/site-packages/django/contrib/auth/models.py", line 2, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "/home/projects/.virtualenvs/Nprojects/lib/python3.6/site-packages/django/contrib/auth/base_user.py", line 47, in <module>
class AbstractBaseUser(models.Model):
File "/home/projects/.virtualenvs/Nproject/lib/python3.6/site-packages/django/db/models/base.py", line 100, in __new__
app_config = apps.get_containing_app_config(module)
File "/home/projects/.virtualenvs/Nproject/lib/python3.6/site-packages/django/apps/registry.py", line 244, in get_containing_app_config
self.check_apps_ready()
File "/home/projects/.virtualenvs/Nproject/lib/python3.6/site-packages/django/apps/registry.py", line 127, in check_apps_ready
raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
Additional data:
-Django 2.1
-Python 3.6.5
The correct name string for the AUTH_USER_MODEL would be appname.modelname. In your case, I suppose it is 'profile.user' (it could be different if you changed the app name by yourself)
I am using Django 1.10, and trying to use the django-dynamic-scraper package following the tutorial: http://django-dynamic-scraper.readthedocs.io/en/latest/getting_started.html
I have encountered the problem when I was calling "python manage.py makemigrations" :RuntimeError: Model class django.contrib.contenttypes.models.ContentType doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
The full version is:
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
utility.execute()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/__init__.py", line 359, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/base.py", line 305, in run_from_argv
self.execute(*args, **cmd_options)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/base.py", line 353, in execute
self.check()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/base.py", line 385, in check
include_deployment_checks=include_deployment_checks,
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/base.py", line 372, in _run_checks
return checks.run_checks(**kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/checks/registry.py", line 81, in run_checks
new_errors = check(app_configs=app_configs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/checks/urls.py", line 14, in check_url_config
return check_resolver(resolver)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/checks/urls.py", line 24, in check_resolver
for pattern in resolver.url_patterns:
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/urls/resolvers.py", line 310, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/urls/resolvers.py", line 303, in urlconf_module
return import_module(self.urlconf_name)
File "/Library/Frameworks/Python.framework/Versions/3.6/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 "/Users/zhangjintao/WorkingPlace/dds/dds/urls.py", line 20, in <module>
url(r'^admin/', admin.site.urls),
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/contrib/admin/sites.py", line 267, in urls
return self.get_urls(), 'admin', self.name
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/contrib/admin/sites.py", line 225, in get_urls
from django.contrib.contenttypes import views as contenttype_views
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/contrib/contenttypes/views.py", line 5, in <module>
from django.contrib.contenttypes.models import ContentType
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/contrib/contenttypes/models.py", line 138, in <module>
class ContentType(models.Model):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/db/models/base.py", line 113, in __new__
"INSTALLED_APPS." % (module, name)
RuntimeError: Model class django.contrib.contenttypes.models.ContentType doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
But my installed apps contain the django.contrib.contenttypes :
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'app',
'dynamic_scraper.models',
]
My models.py:
from django.db import models
from dynamic_scraper.models import Scraper, SchedulerRuntime
from scrapy_djangoitem import DjangoItem
class NewsWebsite(models.Model):
name = models.CharField(max_length=200)
url = models.URLField()
scraper = models.ForeignKey(Scraper, blank=True, null=True, on_delete=models.SET_NULL)
scraper_runtime = models.ForeignKey(SchedulerRuntime, blank=True, null=True, on_delete=models.SET_NULL)
def __unicode__(self):
return self.name
class Article(models.Model):
title = models.CharField(max_length=200)
news_website = models.ForeignKey(NewsWebsite)
description = models.TextField(blank=True)
url = models.URLField()
checker_runtime = models.ForeignKey(SchedulerRuntime, blank=True, null=True, on_delete=models.SET_NULL)
def __unicode__(self):
return self.title
class ArticleItem(DjangoItem):
django_model = Article
My admin.py :
from django.contrib import admin
from .models import Article, NewsWebsite, ArticleItem
# Register your models here.
#admin.register(Article, ArticleItem, NewsWebsite)
class ArticleAdmin(admin.ModelAdmin):
pass
class NewWebsiteAdmin(admin.ModelAdmin):
pass
class ArticleItemAdmin(admin.ModelAdmin):
pass
The urls.py file:
from django.conf.urls import url
from django.contrib import admin
urlpatterns = [
url(r'^admin/', admin.site.urls),
]
The folder structure looks like this:
I'm confused what's wrong with my code...
dynamic_scraper section in INSTALLED_APPS should go without .models. e.g.
INSTALLED_APPS = [
...
'dynamic_scraper',
]
Also, since you're using 1.10, it worth to add an AppConfig for your application: docs
I wanted to include full text search in my django application. I am using whoosh-haystack for this.When I include whoosh and haystack in my installed apps,and execute the command ./manage.py, I am getting an import error. Can anyone sort this out.
settings.py
INSTALLED_APPS = {
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'search',
'whoosh',
'haystack',
}
when I make migration in my model the error which I got is:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\Samad Talukder\AppData\Local\Programs\Python \Python36\lib\site-packages\django\core\management\__init__.py", line 338, in execute_from_command_line
utility.execute()
File "C:\Users\Samad Talukder\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\__init__.py", line 303, in execute
settings.INSTALLED_APPS
File "C:\Users\Samad Talukder\AppData\Local\Programs\Python\Python36\lib\site-packages\django\conf\__init__.py", line 48, in __getattr__
self._setup(name)
File "C:\Users\Samad Talukder\AppData\Local\Programs\Python\Python36\lib\site-packages\django\conf\__init__.py", line 44, in _setup
self._wrapped = Settings(settings_module)
File "C:\Users\Samad Talukder\AppData\Local\Programs\Python\Python36\lib\site-packages\django\conf\__init__.py", line 92, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Users\Samad Talukder\AppData\Local\Programs\Python\Python36\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\Samad Talukder\Desktop\django-env\search\search\settings.py", line 80, in <module>
'PATH': os.path.join(base(), 'whoosh_index')
NameError: name 'base' is not defined
my haystack connection:
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',
'PATH': os.path.join(base(), 'whoosh_index')
},
}
my models.py:
from django.contrib.auth.models import User
from django.db import models
class Author(User):
pass
class Book(models.Model):
title = models.CharField(max_length=300)
author = models.ForeignKey(Author)
isbn = models.CharField(max_length=300)
resume = models.TextField()
def __unicode__(self):
return self.title
for more information I install haystack and whoosh in my django project by django pip install method like this:
pip install haystack
pip install whoosh
The traceback is quite clear:
File "C:\Users\Samad Talukder\Desktop\django-env\search\search\settings.py", line 80, in <module>
'PATH': os.path.join(base(), 'whoosh_index')
NameError: name 'base' is not defined
This means that line #80 of your settings.py file uses a name (base - obviously expected to be a function) that is not defined. Your settings file is missing either an import or a function definition. What base is supposed to do etc is beyond our knowledge (it's definitly not a builtin, and nothing standard in a django settings file) but you should now since it's your project.