-1👍
Turns out the problem was permissions earlier in the setup.
It leads to Django being unable to complete it’s install. pip install django
would fail with a permissions error
on a mkdir
during the Cleaning up...
segment of the install. And while all the files may have been installed, I suppose it wasn’t completely configged.
sudo pip install django
is no better because the django install now has su permissions which helps with the mkdir problem above, while potentially creating other problems.
After both installs, the python console import django
would error.
The fix: the virtual env dirs need to be owned by the user that invoked the virtual envs.
sudo chown -R youruser:youruser /opt/myenv
In my case, puppet created the venv and dirs as the root user.
2👍
I suspect here is where you went wrong:
- You created a virtual environment (
virtualenv --python=/usr/bin/python3.4
) - Next, you forgot to activate it; or you activated it and then you did
sudo pip install django
.
sudo pip
will run the system wide pip
, installing django for Python 2.7.8, rather than for the virtual environment.
If you exit the virtual environment and try to import django – it will work.
To fix the problem, make sure you activate the virtual environment and then do not use sudo to install packages.
- [Answer]-Connect MySQL Workbench with Django in Eclipse in a mac
- [Answer]-What is the best way to implement Query Form in Django ListView?
- [Answer]-MultiValueDictKeyError at /verification/
- [Answer]-Django inclison tag, endless pagination doesn't work
- [Answer]-Search for a key in django.core.cache
0👍
Before installing/using django you should activate your virtualenv. And do not sudo
while you call pip
:
$ source ~/.virtualenvs/myenv/bin/activate
$ pip install django
- [Answer]-What can go wrong with admin url?
- [Answer]-Django staticfiles_urlpatterns not working
- [Answer]-Auto close a file opened in django __init__.py
- [Answer]-Django model form multiplechoice change or remove field