Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")

import django
django.setup()

from django.core.management import call_command
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #You #define #environment #variable #call #accessing
ADD COMMENT
Topic
Name
4+5 =