Have django-extensions installed, can't find shell_plus - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html) +--- Thread: Have django-extensions installed, can't find shell_plus (/thread-11501.html) |
Have django-extensions installed, can't find shell_plus - Larz60+ - Jul-12-2018 I am running python 3.7.0 on OpenSuse Leap 15 I have django-extensions installed, but following command fails: ./manage.py shell_plus --notebook On searching, it's supposed to be part of django-extensions: https://django-extensions.readthedocs.io/en/latest/shell_plus.htmlHas anyone encountered this error, and if so, how to resolve? RE: Have django-extensions installed, can't find shell_plus - Larz60+ - Jul-12-2018 I have resolved part of the problem, and the answer is staring me in the face, but my brain is jumbled from frustration, and I'm having trouble finishing right now. At any rate, here's what has been done. After installing django-extensions in my django virtual environment (which has been activated), here's my pip list: So I see it's installed in the proper place.I then discovered (since I'm new to django, didn't immediately realize this step was necessary) that my django application had to be made aware of the package. This is done by adding 'django-extensions',to the end of the INSTALLED_APPS list in settings.py So, after doing that, I try to run: ./manage.py shell_plus --notebookand get a step further, but still not finding django-extensions: So, I have to leave it alone for a bit and come back to it later.This has to be something simple, but mt tired brain is not in a state where I can recognize what's missing. RE: Have django-extensions installed, can't find shell_plus - snippsat - Jul-13-2018 Always use python to run./.something it can look outside virtual environment.Quick demo,i also modify INSTALLED_APPS and add django-extensions: C:\ λ python -m venv dj_env C:\ λ cd dj_env C:\dj_env λ C:\dj_env\scripts\activate (dj_env) C:\dj_env λ pip innstall django django-extensions (dj_env) C:\dj_env λ django-admin startproject myproject (dj_env) C:\dj_env λ django-admin startapp foo # Now using python inside virtual enviromnent (dj_env) C:\dj_env λ which python /c/dj_env/Scripts/python # Test Django Extensions (dj_env) C:\dj_env\myproject λ python manage.py shell_plus # Shell Plus Model Imports from django.contrib.admin.models import LogEntry ........ Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> exit() (dj_env) C:\dj_env\myproject λ RE: Have django-extensions installed, can't find shell_plus - Larz60+ - Jul-13-2018 Snippsat, Thanks for your response. I am still getting errors: notice that everything is running in the local environment until it tries to run __init__.py which is for some reason being run from my .pyenv environment.
RE: Have django-extensions installed, can't find shell_plus - gontajones - Jul-13-2018 The module name is django_extensions with _ .Here after I put it at: INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django_extensions', ]It's working. RE: Have django-extensions installed, can't find shell_plus - Larz60+ - Jul-13-2018 gontajones, Thanks, that's an elusive one, especially because pip install django-extensions is what's used to load the package, and pip list shows: django-extensions 2.0.8 RE: Have django-extensions installed, can't find shell_plus - gontajones - Jul-14-2018 Yeah, I think everybody tried to import it with - at the first time (I did it too).This must be a recurrent issue at its GitHub! RE: Have django-extensions installed, can't find shell_plus - Larz60+ - Jul-14-2018 you can still import as django-extensions and get the proper package, but the name in setings.py has to have the underscore. Very frustrating! |