2016-04-20 18:41:17 +00:00
project_slug = ' {{ cookiecutter.project_slug }} '
2016-03-06 10:05:24 +00:00
2016-04-20 18:41:17 +00:00
if hasattr ( project_slug , ' isidentifier ' ) :
assert project_slug . isidentifier ( ) , ' Project slug should be valid Python identifier! '
2016-04-25 21:09:37 +00:00
2016-09-26 16:19:15 +00:00
elasticbeanstalk = ' {{ cookiecutter.use_elasticbeanstalk_experimental }} ' . lower ( )
heroku = ' {{ cookiecutter.use_heroku }} ' . lower ( )
docker = ' {{ cookiecutter.use_docker }} ' . lower ( )
2016-06-03 23:35:10 +00:00
2016-09-26 16:19:15 +00:00
if elasticbeanstalk == ' y ' and ( heroku == ' y ' or docker == ' y ' ) :
raise Exception ( " Cookiecutter Django ' s EXPERIMENTAL Elastic Beanstalk support is incompatible with Heroku and Docker setups. " )
2017-04-24 22:43:36 +00:00
if docker == ' n ' :
import sys
python_major_version = sys . version_info [ 0 ]
if python_major_version == 2 :
sys . stdout . write ( " WARNING: Cookiecutter Django does not support Python 2! Stability is guaranteed with Python 3.4+ only. Are you sure you want to proceed? (y/n) " )
yes_options = set ( [ ' y ' ] )
no_options = set ( [ ' n ' , ' ' ] )
choice = raw_input ( ) . lower ( )
if choice in no_options :
sys . exit ( 1 )
elif choice in yes_options :
pass
else :
sys . stdout . write ( " Please respond with %s or %s "
% ( ' , ' . join ( [ o for o in yes_options if not o == ' ' ] )
, ' , ' . join ( [ o for o in no_options if not o == ' ' ] ) ) )