5👍
✅
Invoke django-admin.py like this python django-admin.py
, in your activate virtualenv. Alternatively you can do /path/to/virtualenv/bin/python django-admin.py
.
The best solution is probably adding a shebang to django-admin.py that looks like #!/usr/bin/env python
which should use the python interpreter of your active virtualenv. See https://stackoverflow.com/a/2255961/639054
1👍
You could use pyenv, which will allow you to set your Python interpreter based on what directory you’re in. I also use it with pyenv-virtualenv so that I get all the benefits of isolating my packages per application.
There’s a bit of a learning curve, but it’s worth it if you need to switch Python interpreters to match a production server for instance.
- [Django]-Front-end prototype/skeleton in Django
- [Django]-Upgrading from Django 1.4 to Django 1.7 – will it work?
- [Django]-Django project file structure
Source:stackexchange.com