Django Console and custom settings

I have a settings module with a default.py for production, and then my localmysql.py overrriding some settings.
This works fine for unit tests and for running django, but not for manage.py tasks nor for the Django console.

I tried the DJANGO_SETTINGS_MODULE environment:
>>> os.getenv("DJANGO_SETTINGS_MODULE","")
'settings.localmysql'

but it has no effect. It still tries to connect to the production server...
I notice in django_manage_shell, PYCHARM_DJANGO_MANAGE_MODULE is referenced, but I could not find any documentation.


How can I tell PyCharm to use settings.localmysql for manage.py and Django console?
1
4 comments
Did you select the correct settings file in Settings | Django Support?
0
Avatar
Permanently deleted user
Yes:
image1
0
Avatar
Permanently deleted user
But I suspect the culprit:
settings\localmysql.py should be settings.localmysql
That is not possible to enter though... :-(
0
Avatar
Permanently deleted user

I have the same issue here. I tried to set the DJANGO_SETTINGS_MODULE environment variable in the Django Console settings tab with no success. I assume something in django_manage_shell.run does not respect this variable and the corresponding settings in the Django integration tab too.




0

Please sign in to leave a comment.