[Django]-Using Python 3.7 on Pycharm gives me: "Error: Django is not importable in this environment"

0👍

you can follow these steps, in order to configuring virtualenv in pycharm:

  • Select File, click Settings.
  • In the left pane, enter Project Interpreter in the search box, then click Project Interpreter.
  • In the right pane, click the gear icon, click More….
  • In the Project Interpreters dialog box, click the plus sign +, click Add Local.

    • Enter ~/virtualenvs//bin/python in the path. If you followed the earlier post to setup a virtual environment for Python then enter ~/virtualenvs/api/bin/python.
    • Click OK.
  • Select 2.7.6 virtualenv at ~/virtualenvs/api, click the edit icon.
  • Check Associate this virtual environment with current project.
  • Click OK.
  • Click OK.
  • Click Apply, click OK.

reference: http://exponential.io/blog/2015/02/10/configure-pycharm-to-use-virtualenv/

👤Ali

0👍

  • Open Run/Debug Configuration page
  • Find Enviroment
  • Change Enviroment vaialbles to: PYTHONUNBUFFERED=1;DJANGO_SEETINGS=your_project_name.settings

You should show to Pycharm your projects settings file 🙂 I hope it will work if you select correct Python Interpretet (venv)

Leave a comment