Skip to content

Instantly share code, notes, and snippets.

@un1t
Created February 21, 2015 21:48
Show Gist options
  • Save un1t/56df90961081857650ce to your computer and use it in GitHub Desktop.
Save un1t/56df90961081857650ce to your computer and use it in GitHub Desktop.
How to run scripts outside django
# coding: utf-8
import os
import django
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")
django.setup()
# write your code here
@geekyarthurs
Copy link

For anyone who's trying to use the above mentioned @nurettin you need to install django-extensions.

Further info : https://django-extensions.readthedocs.io/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment