I’m using a virtual environment, and I’m trying to create an empty Postgresql database (I had a sqlite3 db before). I’ve created the database and altered the settings, and now when I run “sudo python manage.py makemigrations”, I get an error, even though I’ve installed the packages (environ in this case).
There shouldn’t be a reason for you to need to use
sudo when running
python manage.py makemigrations. If you run the following
which commands you’ll see that using
sudo is changing the context in which your running Django commands.
(venv) schillingt@home-ubuntu:~/Projects/example$ sudo which python /usr/bin/python (venv) schillingt@home-ubuntu:~/Projects/example$ which python /home/schillingt/Projects/example/venv/bin/python
Using sudo is breaking me out of the virtualenv shell and the script being executed won’t be able to find the packages that were installed in that virtualenv. This may explain why
makemigrations can’t find the package
Thank you. I have it now!