I'm diving into a Django docs and I'm using the latest Django (4.0.4) and Python 3.10.0
Whenever I try the command django-admin startproject mysite it gives the error "AttributeError: module 'collections' has no attribute 'Iterator'"
I am using a virtual environment as well which has the Django installed on it.
I tried uninstalling the django and reinstalling but no changed in the program..
Please guide me into the right direction.
Thank you!
Django 4.0.4 was just released few days back.
You know, django-admin is a Python script that gets added to your PATH variable so that it's invocable from the command line with django-admin (as opposed to something like python3 -m django_admin) maybe there was an older version lurking around your PATH that reinstalling will help you fix
or
Use an older version of Python (Django 2.x, as used by that project supports up to Python 3.7).
Related
Hello i am trying to create search app in My Django project using Haystack and Solr but i receive this error "AttributeError: type object 'BaseCommand' has no attribute 'option_list'"
I am running this command : python manage.py rebuild_index
I am using :
Python 3.6.4
solr-4.10.4
haystack 2.4.0
Django 2.0
If the post isn't clear i am ready to explain it more
See the error
I had the same problem, #alasdair's answer helped me fix it.
Basically you're using old packages with a new version of django. Downgrading your django to v1.9 or upgrading pysolr and django-haystack packages will solve the problem.
Be advised that updating Haystack will FORCE-UPGRADE Django to the latest version. For production sites, that may not be advisable without testing first.
I'm trying a Django tutorial. For some reason my existing superuser got deleted; creating that went fine, but I can't make another one. This also happens when I try to use pip.
I didn't change anything in the libraries so not sure why this happens now but didn't before. On windows 7 (Python 3.6.3 and Django 1.11). I've seen similar but not the exact same problems for Windows. Still I checked the file and there seems to be a PathLike class.
I've also tried to repair my Python installation but it didn't help. any ideas?
Seems like you may have modified the settings.py file. But as MrName mentioned you need to share full stack trace
This looks like a feature that changed in Python3.6 as you can see here. Make sure that your python version is 3.6 or greater.
Update your Python and Django version and that will work perfect.
AttributeError: module 'os' has no attribute 'PathLike'
Installing it into the global site-packages with the below command solved my problem:
pip install --user virtualenvwrapper
I have looked into post with the same problem as mine but never got lucky to find solution of mine. I have installed python 3.4.1 and and install django through git. I have also set my environment variable PATH to C:\Python34\Scripts but everytime I type django-admin --version in my command promt, it says not recognize as internal or external command and when using python shell when I type import django it says importerror: No module named django. What am I missing here? Please help. Thanks a lot.
I've just started looking into python and django.. Im pretty sure ive successfull installed both python and the django framework and i managed to add python and django-admin.py to my system path but now when i run the command django-admin.py startproject My_Test_Site, in the folder i want to create a new project directory in (just following the tutorials), i get the following error:
What am i doing wrong?
This is not a Django error. It appears it cannot find the Python module unicodedata which is part of the Python Standard Library (docs). I see that there is also a bug report about this issue (Python 2.7 on Windows, see here). On the other hand, some people there report that reinstalling their Python installation fixed the problem. You could give that a try.
notice the last line, it says import unicodedata, importError
im guessing you probably didnt install your django properly.
so reinstall it and check that django is in your "path", i believe django does this automatically when it installs but doesnt hurt to double check.
if reinstalling django still doesn't work, i suggest you uninstall python and django related stuff.
then install python, install pip, then use pip install django.
Super simple question: I went through the "getting start" doc for haystack (using whoosh; I installed both python-whoosh and haystack using pip (first time using it)), and I simply cannot run python manage.py rebuild_index. I get this error:
python manage.py rebuild_index
Unknown command: 'rebuild_index'
Type 'manage.py help' for usage
I do have 'haystack' listed in my INSTALLED_APPS in settings.py, so this solution doesn't seem to work for me. I also don't get import errors when I run "import haystack" so it does exist. I tried this on my existing project as well as a brand new object made just for this and I just can't get it to work.
However, when I import haystack after python manage.py shell and try haystack.__version__ I get "AttributeError: 'module' object has no attribute 'version'". I get a similar error if I try haystack.management: it has no management attribute.
It must be something super simple I'm missing. Thank you for reading this!
Did you perhaps install the wrong thing? This (embarrassingly) happend to me just today. Make sure you install 'django-haystack' and not just 'haystack' (and you will have to remove 'haystack', since it conflicts with 'django-haystack').
Do you have the path to haystack in your Python path? (Either the PYTHONPATH shell variable or the sys.path Python list.)
Did you run python manage.py syncdb?
Does python manage.py shell followed by import haystack work?
After import haystack, what do you get for haystack.__version__?
In the same shell, type the following. Do you get errors for any of them?
haystack.management.commands
haystack.management.commands.rebuild_index
haystack.management.commands.rebuild_index.Command.help
I had the same error that you did, and fixed it by removing the old .egg and installing directly from the latest version. You can use easy_install:
easy_install https://github.com/toastdriven/django-haystack/zipball/v1.2.4
Hope this helps!
I had the same problem - for whatever reason, the haystack version in pip is quite old and obsolete (v 0.6 as of today). To use django-haystack check out the v1. source.
It compiles and installs simply with
python setup.py build
python setup.py install
Hope that helps!
I just had the same problem and hadn't set HAYSTACK_SITECONF in my settings.py.
Instead of using python manage.py rebuild_index try using ./manage.py rebuild_index
just do
pip uninstall haystack and
pip install django-haystack