django install warning and manage.py runserver failure - django

I'm trying to work through the django tutorial, and seem to have a problem with the django installation (on Windows 7). I've installed Python, and pip, and installed Django via pip, at which point I got this output:
Downloading/unpacking Django
Downloading Django-1.5.1.tar.gz (8.0MB): 8.0MB downloaded
Running setup.py egg_info for package Django
warning: no previously-included files matching '__pycache__' found under dir
ectory ''
warning: no previously-included files matching '.py[co]' found under direct
ory '*'
Installing collected packages: Django
Running setup.py install for Django
warning: no previously-included files matching '__pycache__' found under dir
ectory ''
warning: no previously-included files matching '.py[co]' found under direct
ory '*'
Successfully installed Django
Cleaning up...
Since the messages were only warnings, I proceeded with trying to run django From within the project folder, I issue:
C:\data\spark2\spark\spark_project>python manage.py runserver
and receive the message:
ImportError: No module named debug_toolbar
then the command prompt is displayed again.
I've tried uninstalling and re-installing Django, to no avail.
Any ideas?

You forgot to install django-debug-toolbar which your project requires.
Running pip install django-debug-toolbar should fix that import error.
Ideally projects come with a Requirements.txt file that contains the output of pip freeze. If you have one, you can install all of the requirements by running pip install -r Requirements.txt

Related

Error installing django-heroku Error: pg_config executable not found

I tried installing django-heroku via pip so I can deploy my project on heroku but during installation of django-heroku it tried to install psycopg2 along only to produce an error:
Error:pg_config executable not found.
pg_config is required to build psycopg2 from source.please add the directory containing pg_config to the $PATH or specify the full executable path with the option:
python setup.py build_ext--pg-config/path/to/pg_config build...
or with the pg_config option in 'setup.cfg'.
And I also wish to know if I'm required to pip install it since heroku installs the libaries specified in the requirements.txt file,if not required are there changes I need to make to my project before deployment.
Perhaps not optimal solution but it did work for me.
pip install --no-dependencies django-heroku
Be sure to have other required packages installed.
pip install django
pip install whitenoise
pip install psycopg2-binary
P.S. I have already had postgresql installed on my Mac. Not sure why I was getting the same error.
I renamed "psycopg2" in the python site packages folder to "psycopg2-binary", and this fixed my issue.

Failed building wheel for python-ldap (windows) *first stackoverflow ask*

I've installed flask, flask_login, and ldap in the virtualenv for my flask package (to authenticate ldap users with the usernames & passwords of the other users at my company).
When I run my flask app, I get "AttributeError: 'module' object has no attribute 'initialize'"
I'm tried "pip install python-ldap"
but I get a red error (sandwiched between other white text) that reads:
"Failed building wheel for python-ldap"
I have thoroughly examined these:
How to install python-ldap on a python 2.7 virtualenv on windows without compiling
Installing python-ldap in a virtualenv on Windows
https://www.python-ldap.org/docs.html
https://www.linuxjournal.com/article/6988?page=0,1
to no avail.
I've had this error for days now...
(also:
pip install openldap
gives:
Collecting openldap
Could not find a version that satisfies the requirement openldap (from versions: )
No matching distribution found for openldap
...(in and outside of my venv) if that information helps)
I had this error last week and after switching work computers, I recreated the virtualenv and installed all of the other packages and dependencies successfully.
my requirements.txt file contains these lines after a line of git stuff:
click==6.7
Flask==0.12.2
Flask-Login==0.4.0
itsdangerous==0.24
Jinja2==2.9.6
ldap==1.0.2
ldap3==2.2.4
MarkupSafe==1.0
pyasn1==0.2.3
Werkzeug==0.12.2
Has anyone successfully installed python-ldap into a flask virtualenv with windows? If so... how?!
Go to:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#python-ldap
download python_ldap-2.4.38-cp27-cp27m-win_amd64.whl in the same directory that your venv folder is listed under
(ex.)
/myrepo
/myapp
/myapp
/venv
/run.py
/python_ldap-2.4.38-cp27-cp27m-win_amd64.whl
install the .whl file while inside of your venv
venv\Scripts\activate
pip install python_ldap-2.4.38-cp27-cp27m-win_amd64.whl
Voila!
The error
ERROR: Failed building wheel for python-ldap
can occur for several reasons. You actually have to look at what happened above this line. In my case, I just had to install missing dependencies to build python-ldap. You can look them up here. For CentOS 8, I had to install:
sudo dnf install openldap-devel python3-devel gcc
to make
python3 -m pip install --user python-ldap -U
work.

TinyMCE installation gives warning

I did pip install django-tinymce and it gives this warning
Downloading django-tinymce-1.5.1.tar.gz (2.4MB): 2.4MB downloaded
Running setup.py egg_info for package django-tinymce
warning: no previously-included files found matching '*.pyc'
Installing collected packages: django-tinymce
Running setup.py install for django-tinymce
warning: no previously-included files found matching '*.pyc'
Successfully installed django-tinymce
Cleaning up...
What does this error means
I have have also installed Grappelli and its documentation says TinyMCE comes with it by default.
So, was pip install django-tinymce unnecessary on my part
The Grappelli documentation doesn't give proper explanation to use it. Can someone gives proper steps to configure tinyMCE
Also when I did python manage.py schemamigration --auto added_tinymce
I got this error
TypeError: __init__() got an unexpected keyword argument 'widget'
so can someone please guide me through it

warning in django installation via pip

When I try to install django I keep getting this warning. I tried the solution mentioned in this question but still its the same what should I do ?
My virtual os is ubuntu in vagrant.
Downloading/unpacking django==1.5.1
Downloading Django-1.5.1.tar.gz (8.0Mb): 8.0Mb downloaded
Running setup.py egg_info for package django
warning: no previously-included files matching '__pycache__' found under directory '*'
warning: no previously-included files matching '*.py[co]' found under directory '*'
Installing collected packages: django
Running setup.py install for django
warning: no previously-included files matching '__pycache__' found under directory '*'
warning: no previously-included files matching '*.py[co]' found under directory '*'
changing mode of /home/vagrant/blog-venv/bin/django-admin.py to 777
Successfully installed django
Cleaning up...
These warnings are not a problem; Django is still being successfully installed. (The previous question you mention is asking something quite different, and is not concerned with the warnings.)

pip install: How to force a specific package version

I'm trying to install Django 1.4.3, but when I execute pip install, pip keeps installing Django 1.5 version instead 1.4.3
sudo pip install -I Django==1.4.3
It returns:
Downloading/unpacking Django==1.4.3
Running setup.py egg_info for package Django
warning: no previously-included files matching '__pycache__' found under directory '*'
warning: no previously-included files matching '*.py[co]' found under directory '*'
=== >>>> Requested Django==1.4.3, but installing version 1.5 <<<< ====
Installing collected packages: Django
Found existing installation: Django 1.5
Uninstalling Django:
Successfully uninstalled Django
Running setup.py install for Django
warning: no previously-included files matching '__pycache__' found under directory '*'
warning: no previously-included files matching '*.py[co]' found under directory '*'
changing mode of /usr/local/bin/django-admin.py to 755
Successfully installed Django
Cleaning up...
but if I execute pip freeze, it keeps showing
Django==1.5
What am I doing wrong?
Thank you
This could/should/can be helped by clearing the build dir for Django in pip.
There is a bug for this, since version 1.1 see here for details
You can start checking for these folders here if you're on OS X or unix like systems:
~/.pip
/tmp/pip-build-root (or pip-build-$USER, if you aren't running pip as root).
This is if you haven't specified a new build folder when you installed the first version of Django.
Good luck!
As limelight says, you should empty your cache and build directories, or pass in a temporary clean location with the --download-cache and flag.
$ pip help install
[...]
--download-cache <dir> Cache downloaded packages in <dir>.
-b, --build <dir> Directory to unpack packages into and build in. The default in a virtualenv is "<venv path>/build". The default for global installs is
"<OS temp dir>/pip-build-<username>".
I'd like to warn any readers to not use sudo pip install to install Django. It installs Django system-wide. And changing the system-wide version could break system-packages that depend on it. For instance, Ubuntu MAAS and Cobbler depend on the system django package. These are typically services you don't want to break.
If you need a different version than the system-package, use virtualenv to isolate your dependencies from the system.
OP seems to be on OSX and I don't know of any server-wide Mac Django, but that may change. Consider installing python packages with sudo at par to changing the system-installed python with python 3; it might work for now, but have some paracetamol in stock, as you're in for some headaches.
Check your local cache and remove it can be help. I hava installed pymongo==2.5.2. To install pymongo==2.4.1, I remove the cache in /tmp/pip-build-root/pymongo.Then I install pymongo 2.4.1 successfully.