Last active
May 22, 2018 21:25
-
-
Save Lh4cKg/3993a05473dc43909770c46e18172e98 to your computer and use it in GitHub Desktop.
configure and run django script file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# old django version: 1.6.x | |
# configure and run django script | |
if __name__ == '__main__': | |
import os | |
import sys | |
import importlib | |
proj_path = '/home/gogua/projects/profenv/profiling/' | |
sys.path.append(proj_path) | |
os.chdir(proj_path) | |
os.environ["DJANGO_SETTINGS_MODULE"] = "profiling.settings.lg" | |
importlib.import_module("profiling.settings.lg") | |
from django.conf import settings | |
reload(sys) | |
sys.setdefaultencoding("utf-8") # @UndefinedVariable | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment