Reputation: 119
I have a Django project in Pycharm with a virtualenv named venv
My Terminal path is:
(venv) C:\projects\Django\deya>
I install my packages inside this virtualenv.
The problem is that when I run project from Pycharm run icon, I am getting errors like:
No module named 'django_tables2'
The command that Pycharm running is:
"C:\Program Files\JetBrains\PyCharm 2017.3\bin\runnerw.exe" C:\Users\kostas\AppData\Local\Programs\Python\Python37\python.exe C:/projects/Django/deya/manage.py runserver 127.0.0.1:8000
My project runs fine from Terminal command line, inside virtualenv:
(venv) C:\projects\Django\deya>python manage.py runserver
Can you help me setup the configuration of my project to run from Pycharm run console?
Thanks in advance.
Upvotes: 0
Views: 1014
Reputation: 9521
This is complaining about not finding django-tables2
module.
Did you install django-tables2
module in your virutalenv
pip install django-tables2
The installation instruction for the module can be found here.
Further, this must be installed from within your activated virtualenv
Update after your comment:
Pycharm is picking the Python located at: C:\Users\kostas\AppData\Local\Programs\Python\Python37\python.exe
This does not look like python from a virtualenv
Link for changing this configuration provided in the comment.
Upvotes: 3
Reputation: 1723
Open PyCharm settings and search for "project interpreter", click on the gear icon, select "Add Local", in the dialog select "Existing environment" and point to your virtualenvs "python.exe". After closing the dialog ensure that your virtualenv is the selected project interpreter, close the settings and try running your app again.
Upvotes: 2