Search code examples
djangopycharmdjango-haystack

pycharm can't find haystack but terminal can


Trying to install Haystack following django-haystack documentation the basic tutorial for installation and configuration but a problem faces me as I can't import haystack in Search-Indexes py file Haystack is installed the env and in the root

Settings.py

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'haystack',
'products',
]
HAYSTACK_CONNECTIONS = {
        'default': {
            'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
            'URL': 'http://127.0.0.1:8983/solr'

        },
    }

Search_Indexes.py

import datetime
from haystack import indexes <<error can't find indexes

yet in -->

>>Terminal in my env

(amirshop) amir@amir-In######:~/####/#####$ python manage.py shell
Python 2.7.12 (default, Jul  1 2016, 15:12:24) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from haystack import indexes
>>> indexes.
indexes.BasicSearchIndex(               indexes.FacetDateField(                 indexes.NgramField(                     indexes.__package__                     indexes.get_identifier(
indexes.BooleanField(                   indexes.FacetDateTimeField(             indexes.SearchField(                    indexes.__reduce__(                     indexes.get_model_ct(

What is the problem or precisely where?


Solution

  • Solved

    just I point again my pycharm to myenv in the usr bin using this steps: here Thanks @Sardorbek Imomaliev 1 -

    1. Settings (ctrl + Alt +S)
    2. project:Name
    3. Interpreter
    4. Choose your interpreter and see installed packages