Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Starting script to enable Django Console in IntelliJ IDEA Ultimate
import os
import sys
from runpy import run_module
import django
from django.core import management
print(f"Python {sys.version} on {sys.platform}")
print(f"Django {django.get_version()}")
print(f"Current dir: {os.getcwd()}")
def execute_django_manage_file():
def execute_from_command_line_stub(argv=None):
pass
management.execute_from_command_line = execute_from_command_line_stub
django_manage_file = os.getenv('PYCHARM_DJANGO_MANAGE_MODULE')
if not django_manage_file:
django_manage_file = 'manage'
run_module(
mod_name=django_manage_file,
init_globals=None,
run_name='__main__',
alter_sys=True,
)
django.setup()
execute_django_manage_file()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.