mirror of
https://github.com/r4sas/py-i2phosts
synced 2025-01-22 12:34:17 +00:00
Properly setup django in standalone scripts
https://docs.djangoproject.com/en/dev/releases/1.7/#standalone-scripts
This commit is contained in:
parent
8905486e3e
commit
06468a3c7c
@ -35,6 +35,8 @@ else:
|
||||
DJANGO_PROJECT_PATH = os.path.dirname(sys.argv[0]) + '/..'
|
||||
sys.path.insert(1, DJANGO_PROJECT_PATH)
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = DJANGO_SETTINGS_MODULE
|
||||
import django
|
||||
django.setup()
|
||||
from pyi2phosts.postkey.models import i2phost
|
||||
from pyi2phosts.lib.utils import validate_config
|
||||
|
||||
|
@ -40,6 +40,8 @@ else:
|
||||
DJANGO_PROJECT_PATH = os.path.dirname(sys.argv[0]) + '/..'
|
||||
sys.path.insert(1, DJANGO_PROJECT_PATH)
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = DJANGO_SETTINGS_MODULE
|
||||
import django
|
||||
django.setup()
|
||||
from pyi2phosts.postkey.models import i2phost
|
||||
from pyi2phosts.lib.utils import get_logger
|
||||
from pyi2phosts.lib.utils import validate_config
|
||||
|
@ -43,6 +43,8 @@ else:
|
||||
DJANGO_PROJECT_PATH = os.path.dirname(sys.argv[0]) + '/..'
|
||||
sys.path.insert(1, DJANGO_PROJECT_PATH)
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = DJANGO_SETTINGS_MODULE
|
||||
import django
|
||||
django.setup()
|
||||
from pyi2phosts.lib.utils import get_logger
|
||||
from pyi2phosts.lib.utils import validate_config
|
||||
from pyi2phosts.extsources.models import ExternalSource
|
||||
|
@ -40,6 +40,8 @@ else:
|
||||
DJANGO_PROJECT_PATH = os.path.dirname(sys.argv[0]) + '/..'
|
||||
sys.path.insert(1, DJANGO_PROJECT_PATH)
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = DJANGO_SETTINGS_MODULE
|
||||
import django
|
||||
django.setup()
|
||||
from pyi2phosts.postkey.models import i2phost
|
||||
from pyi2phosts.lib.validation import validate_hostname
|
||||
from pyi2phosts.lib.validation import validate_b64hash
|
||||
|
@ -43,6 +43,8 @@ else:
|
||||
DJANGO_PROJECT_PATH = os.path.dirname(sys.argv[0]) + '/..'
|
||||
sys.path.insert(1, DJANGO_PROJECT_PATH)
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = DJANGO_SETTINGS_MODULE
|
||||
import django
|
||||
django.setup()
|
||||
from pyi2phosts.postkey.models import i2phost
|
||||
from pyi2phosts.lib.utils import get_logger
|
||||
from pyi2phosts.lib.utils import validate_config
|
||||
|
@ -128,6 +128,8 @@ else:
|
||||
DJANGO_PROJECT_PATH = os.path.dirname(sys.argv[0]) + '/..'
|
||||
sys.path.insert(1, DJANGO_PROJECT_PATH)
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = DJANGO_SETTINGS_MODULE
|
||||
import django
|
||||
django.setup()
|
||||
from pyi2phosts.lib.utils import get_logger
|
||||
from pyi2phosts.lib.utils import validate_config
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user