| author | ymh <ymh.work@gmail.com> |
| Sat, 06 Jul 2019 01:00:53 +0200 | |
| changeset 204 | 0c78763b5f10 |
| parent 188 | 00cf90eb0f5a |
| permissions | -rw-r--r-- |
|
188
00cf90eb0f5a
Correct index file and add a favicon. increment version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
1 |
#!{{backend_venv}}/bin/python3
|
|
00cf90eb0f5a
Correct index file and add a favicon. increment version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
2 |
import os |
|
00cf90eb0f5a
Correct index file and add a favicon. increment version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
3 |
import sys |
|
00cf90eb0f5a
Correct index file and add a favicon. increment version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
4 |
|
|
00cf90eb0f5a
Correct index file and add a favicon. increment version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
5 |
if __name__ == "__main__": |
|
00cf90eb0f5a
Correct index file and add a favicon. increment version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
6 |
os.environ.setdefault("IRINOTES_CONFIG_BASE", "{{backend_config_base}}")
|
|
00cf90eb0f5a
Correct index file and add a favicon. increment version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
7 |
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "irinotes.settings")
|
|
00cf90eb0f5a
Correct index file and add a favicon. increment version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
8 |
try: |
|
00cf90eb0f5a
Correct index file and add a favicon. increment version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
9 |
from django.core.management import execute_from_command_line |
|
00cf90eb0f5a
Correct index file and add a favicon. increment version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
10 |
except ImportError: |
|
00cf90eb0f5a
Correct index file and add a favicon. increment version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
11 |
# The above import may fail for some other reason. Ensure that the |
|
00cf90eb0f5a
Correct index file and add a favicon. increment version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
12 |
# issue is really that Django is missing to avoid masking other |
|
00cf90eb0f5a
Correct index file and add a favicon. increment version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
13 |
# exceptions on Python 2. |
|
00cf90eb0f5a
Correct index file and add a favicon. increment version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
14 |
try: |
|
00cf90eb0f5a
Correct index file and add a favicon. increment version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
15 |
import django |
|
00cf90eb0f5a
Correct index file and add a favicon. increment version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
16 |
except ImportError: |
|
00cf90eb0f5a
Correct index file and add a favicon. increment version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
17 |
raise ImportError( |
|
00cf90eb0f5a
Correct index file and add a favicon. increment version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
18 |
"Couldn't import Django. Are you sure it's installed and " |
|
00cf90eb0f5a
Correct index file and add a favicon. increment version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
19 |
"available on your PYTHONPATH environment variable? Did you " |
|
00cf90eb0f5a
Correct index file and add a favicon. increment version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
20 |
"forget to activate a virtual environment?" |
|
00cf90eb0f5a
Correct index file and add a favicon. increment version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
21 |
) |
|
00cf90eb0f5a
Correct index file and add a favicon. increment version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
22 |
raise |
|
00cf90eb0f5a
Correct index file and add a favicon. increment version
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
23 |
execute_from_command_line(sys.argv) |