-
Notifications
You must be signed in to change notification settings - Fork 76
Expand file tree
/
Copy pathmanage.py
More file actions
executable file
·34 lines (27 loc) · 1.15 KB
/
manage.py
File metadata and controls
executable file
·34 lines (27 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python3
""" This is the main program for Django """
import os
import sys
def is_venv():
""" Determine if we are running in Pipenv shell """
return (hasattr(sys, 'real_prefix') or
(hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix))
if __name__ == '__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'cfc_project.settings')
os.environ.setdefault('LD_LIBRARY_PATH', '/usr/local/lib')
if not is_venv():
print(sys.executable, sys.base_prefix, sys.prefix)
print('Virtual Environment: ERROR **NOT FOUND**')
print('Did you forget to activate your virtual environment?')
print('To enter virtual environment: pipenv shell')
print('To exit virtual environment: exit')
sys.exit()
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
print(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?", exc
)
execute_from_command_line(sys.argv)