PyCharm 4 - Django Console Left

PyCharm in 3.4 included the menu options of the python and django console. Just switched to PyCharm 4 and the entry "Django Console" disappeared. Should I activate it somewhere?

Attempting to run django code in the python console results in a normal configuration module error not being configured. HEnce, "automatic detection" works nit.

DJANGO_SETTINGS_MODULE is set correctly in /manage.py and main_module / uwsgi.py to point to "main_module.settings"

The project was created using PyCharm 3.x. Maybe it does not detect the project for some reason as a django project? Everything else works fine: starting django server, delaying templates, etc.

+4
source share
2 answers

I had the same problem and found a solution by examining the settings of a newer project (created in a later version of PyCharm).

Put the following code in your Django console settings (Settings> Build, Run, Deploy> Console> Django Console> Run the script):

import sys; print('Python %s on %s' % (sys.version, sys.platform)) import django; print('Django %s' % django.get_version()) sys.path.extend([WORKING_DIR_AND_PYTHON_PATHS]) if 'setup' in dir(django): django.setup() import django_manage_shell; django_manage_shell.run(PROJECT_ROOT) 

This code exists by default when the project is executed in the new PyCharm.

+5
source

It was encapsulated in the Python console . You can test the Django application in the Python console. From JetBrains Blog

Improved Python / Django console tool window

PyCharm automatically determines what type of console should be launched depending on your project type and context. The console can be launched through the menu of the tool window, as shown in the figure below or using the shortcut "Ctrl + E":

+5
source

Source: https://habr.com/ru/post/1247052/


All Articles