diff --git a/modules/deploy.py b/modules/deploy.py index 4996c05..8862511 100644 --- a/modules/deploy.py +++ b/modules/deploy.py @@ -7,12 +7,28 @@ from fabric.operations import local from .utils import virtualenv_source, booleanize, loggify from .utils import print_console +from .utils import link_create + +from .nginx import upload as upload_nginx +from .nginx import remove as nginx_remove +from .supervisor import upload as upload_supervisor +from .supervisor import remove as supervisor_remove + from .pip import setup_virtualenv from .pip import bootstrap_pip +from .pip import install as pip_install + +from .django import create_project +from .django import generate as django_generate +from .django import collectstatic as django_collectstatic + +from . import initialize +from . import docker +from . import database as db + import os - import logging @@ -82,7 +98,6 @@ def bootstrap(): bootstrap_pip() # create the django project - from django import create_project create_project() # @@ -109,8 +124,6 @@ def bootstrap(): # links before creating them, otherwise you get really weird errors # where the a link is recreated within the destination link - from utils import link_create - if env.debug: logger.debug("virtualenv.root : %s" % configuration.virtualenv.paths.root) @@ -154,10 +167,6 @@ def bootstrap(): # create and link the scripts that manage the server # e.g. nginx, supervisor, gunicorn - from nginx import upload as upload_nginx - from supervisor import upload as upload_supervisor - from django import generate as django_generate - print_console("creating gunicorn script") django_generate('gunicorn', True) django_generate('local', True) @@ -171,8 +180,6 @@ def bootstrap(): # # instantiate docker containers if any - import docker - print_console("check to see if docker containers are used") if hasattr(configuration, "docker"): @@ -219,15 +226,12 @@ def bootstrap_part1(): @task def bootstrap_part2(): - import database as db - configuration = env.config if env.debug: logger = loggify('deploy', 'bootstrap') # create the django project - from django import create_project create_project() # @@ -254,8 +258,6 @@ def bootstrap_part2(): # links before creating them, otherwise you get really weird errors # where the a link is recreated within the destination link - from utils import link_create - if env.debug: logger.debug("virtualenv.root : %s" % configuration.virtualenv.paths.root) @@ -299,10 +301,6 @@ def bootstrap_part2(): # create and link the scripts that manage the server # e.g. nginx, supervisor, gunicorn - from nginx import upload as upload_nginx - from supervisor import upload as upload_supervisor - from django import generate as django_generate - print_console("creating gunicorn script") django_generate('gunicorn', True) django_generate('local', True) @@ -316,8 +314,6 @@ def bootstrap_part2(): # # instantiate docker containers if any - import docker - print_console("check to see if docker containers are used") if hasattr(configuration, "docker"): @@ -453,7 +449,6 @@ def sync(full=True, extras=False): exclude=excludeitems) if full: - from pip import install as pip_install pip_install('--all') # overrides() @@ -463,15 +458,10 @@ def sync(full=True, extras=False): # NOTE: if using full synch if full: - from nginx import upload as upload_nginx - from supervisor import upload as upload_supervisor - from django import generate as django_generate - upload_supervisor() django_generate('gunicorn', True) upload_nginx() - from django import collectstatic as django_collectstatic django_collectstatic() @@ -484,8 +474,6 @@ def media(source_branch): """ configuration = env.config - import initialize - print("project.branch: %s" % configuration.project.branch) # @@ -693,14 +681,10 @@ def remove(full=True): # because otherwise they interfere with this modules version # of "remove" - from nginx import remove as nginx_remove - from supervisor import remove as supervisor_remove - nginx_remove() supervisor_remove() - from database import drop_all as db_drop_all - db_drop_all() + db.drop_all() # # check to see if the parent directory contains anything else