-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathprerequisites.py
38 lines (29 loc) · 1.01 KB
/
prerequisites.py
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
35
36
37
38
from __future__ import print_function
import sys
# Check that we are in an activated virtual environment
try:
import os
virtual_env = os.environ['VIRTUAL_ENV']
except KeyError:
print("It doesn't look like you are in an activated virtual environment.")
print("Did you make one?")
print("Did you activate it?")
sys.exit(1)
# Check that we have installed Django
try:
import django
except ImportError:
print("It doesn't look like Django is installed.")
print("Are you in an activated virtual environment?")
print("Did you pip install from requirements.txt?")
sys.exit(1)
# Check that we have the expected version of Django
expected_version = (1, 6, 1)
try:
assert django.VERSION[:3] == expected_version
except AssertionError:
print("It doesn't look like you have the expected version of Django installed.")
print("You have {0}".format('.'.join([str(i) for i in django.VERSION][:3])))
sys.exit(1)
# All good, have fun!
print("Everything looks okay to me... Have fun!")