1

I started the Django's shell using:

python3 manage.py shell

but weirdly the python interpreter is kicking off instead (I see >>> instead of [n]:, and the initializing text contains no Django information, besides the main imports for the shell aren't executed)

considering that: I'm in ubuntu 20.04, It was running with no problem with python instead of python3, now python isn't recognized but it's linked to python3 so no difference "isn't it??!".

slimguat
  • 45
  • 5

1 Answers1

0

Such problems can appear if you're using global python installation instead of virtual enviroments. It's better to create a virtual enviroment.

sudo apt install -y python3-venv

Then cd to your project directory and execute:

python3 -m venv env
source venv/bin/activate

Then install your requirements and start django shell as usual, by executing

python manage.py shell
rely
  • 16
  • 3
  • Nice, so mark my answer as correct, please :) Be advised: now every time you open up your project directory, you need to execute "source venv/bin/activate" before opening shell or running a server. If youre activated venv correctly, there will be "(venv)" at the left of your username in terminal – rely Aug 05 '20 at 07:38
  • yes it worked perfectly sorry I forget to check the answer – slimguat Aug 13 '20 at 08:23