run script in django


1) write in terminal:

  export DJANGO_SETTINGS_MODULE=mysite.settings


2) use this code first line of script:

  import django
django.setup()


3) run scriprt:

  python -m app.script


date:Nov. 28, 2023