Created
December 2, 2019 18:34
-
-
Save Louis-Saglio/33a4eb4207f33a76c9c6b1ed44bb1cc1 to your computer and use it in GitHub Desktop.
Django console starting script for Pycharm with docker interpreter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When a Django project is configured with an interpreter located in a docker container, the python console encounter errors. | |
To fix that, go to file > settings > Build, Execution, Deployment > Console > Django Console. | |
Then override the starting script with the following snippet : | |
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, '/opt/.pycharm_helpers/pycharm', '/opt/.pycharm_helpers/pydev']) | |
if 'setup' in dir(django): django.setup() | |
import django_manage_shell; django_manage_shell.run(PROJECT_ROOT) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment