Hi,
the solution is written in the error message "You must either define the
environment variable DJANGO_SETTINGS_MODULE or call
settings.configure()...". But I would recommend you to use
https://django-extensions.readthedocs.io/en/latest/runscript.html. I think
it is what you are want. ;)

Regards.

Adam

čt 13. 2. 2020 v 14:03 odesílatel Sourish Kundu <sourishkund...@gmail.com>
napsal:

> So I am trying to access one of my models created in views.py in another
> script. This second script is the one I would like manually run. It imports
> the model without any errors; however, when I try to run it using PyCharm,
> I get this error:
>
> *django.core.exceptions.ImproperlyConfigured: Requested setting
> INSTALLED_APPS, but settings are not configured. You must either define the
> environment variable DJANGO_SETTINGS_MODULE or call settings.configure()
> before accessing settings.*
>
> Any help on resolving this issue would be very much appreciated.
>
>
> Thanks,
> Sourish
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/2c9b2d34-a9ab-4a2f-a1e4-e2694c265ea0%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/2c9b2d34-a9ab-4a2f-a1e4-e2694c265ea0%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAB9%3DGXasEd5NmCzc9B4dw4xZUdcPZnqNg_maQJqQ%2B%2B_gjCG1mA%40mail.gmail.com.

Reply via email to