new file: api.pyc new file: conf/fabric.yml new file: fabfile.py new file: fabfile.pyc new file: modules/__init__.py new file: modules/__init__.pyc new file: modules/conf_setup.py new file: modules/conf_setup.pyc new file: modules/configuration_setup.py new file: modules/database.py new file: modules/database.pyc new file: modules/deploy.py new file: modules/deploy.pyc new file: modules/django.py new file: modules/django.pyc new file: modules/docker.py new file: modules/docker.pyc new file: modules/initialize.py new file: modules/initialize.pyc new file: modules/maintenance.py new file: modules/maintenance.pyc new file: modules/nginx.py new file: modules/nginx.pyc new file: modules/pip.py new file: modules/pip.pyc new file: modules/setup.pyc new file: modules/supervisor.py new file: modules/supervisor.pyc new file: modules/testing/__init__.py new file: modules/testing/__init__.pyc new file: modules/testing/configuration_setup.py new file: modules/testing/maintenance.pyc new file: modules/utils.py new file: modules/utils.pyc new file: templates/conf/database/files/db.drop_all.sql.jinja2 new file: templates/conf/database/files/db.drop_db.sql.jinja2 new file: templates/conf/database/files/db.init.sql.jinja2 new file: templates/conf/database/files/db.re_init.sql.jinja2 new file: templates/conf/django/files/gunicorn.jinja2 new file: templates/conf/django/files/gunicorn.unixsocket.jinja2 new file: templates/conf/django/files/local.jinja2 new file: templates/conf/django/files/settings.jinja2 new file: templates/conf/django/files/settings18.jinja2 new file: templates/conf/django/files/wsgi.jinja2 new file: templates/conf/django/files/wsgi.py new file: templates/conf/docker/files/database.jinja2 new file: templates/conf/gunicorn/files/gunicorn.jinja2 new file: templates/conf/gunicorn/files/gunicorn.unixsocket.jinja2 new file: templates/conf/gunicorn/files/local.jinja2 new file: templates/conf/gunicorn/files/settings.jinja2 new file: templates/conf/gunicorn/files/settings18.jinja2 new file: templates/conf/gunicorn/files/wsgi.jinja2 new file: templates/conf/gunicorn/files/wsgi.py new file: templates/conf/nginx/files/default.conf.jinja2 new file: templates/conf/nginx/files/unixsocket.jinja2 new file: templates/conf/supervisor/files/conf_old new file: templates/conf/supervisor/files/supervisor.jinja2 new file: templates/meta/development.yml new file: templates/meta/layout.yml new file: templates/meta/staging.yml new file: templates/readmes/aws.md new file: templates/readmes/gandi.md new file: templates/readmes/reset_migrations.md new file: templates/readmes/setup_gandi.md new file: templates/readmes/translations.md new file: templates/readmes/update_images.md
134 lines
3.5 KiB
Python
134 lines
3.5 KiB
Python
from fabric.api import env, task
|
|
from fabric.operations import run
|
|
|
|
import logging
|
|
|
|
from utils import virtualenv_source, virtualenv
|
|
from utils import print_console
|
|
|
|
|
|
@task
|
|
def setup_virtualenv():
|
|
configuration = env.config
|
|
|
|
if env.debug:
|
|
logging.basicConfig(
|
|
format='\n%(levelname)s: deploy.setup_virtualenv %(message)s',
|
|
level=logging.DEBUG)
|
|
|
|
mkvirtualenv_cmd = "mkvirtualenv --no-site-packages " \
|
|
"{virtualenv_name}".format(
|
|
virtualenv_name=configuration.virtualenv.name)
|
|
|
|
if env.debug:
|
|
logging.debug("virtualenv.workon : %s"
|
|
% configuration.virtualenv.workon)
|
|
|
|
logging.debug("virtualenv.activate : %s"
|
|
% configuration.virtualenv.activate)
|
|
|
|
logging.debug("virtualenv.name : %s"
|
|
% configuration.virtualenv.name)
|
|
|
|
logging.debug("virtualenv.paths.bin : %s"
|
|
% configuration.virtualenv.paths.bin)
|
|
|
|
logging.debug("virtualenv.paths.root : %s"
|
|
% configuration.virtualenv.paths.root)
|
|
|
|
logging.debug("with virtualenv_source(): run(\"\n\t%s\n\t\")".format(
|
|
mkvirtualenv_cmd))
|
|
else:
|
|
|
|
# run("source virtualenvwrapper.sh; mkvirtualenv "
|
|
# "--no-site-packages {virtualenv_name}".format(
|
|
# virtualenv_name=configuration.virtualenv.name))
|
|
|
|
with virtualenv_source():
|
|
run(mkvirtualenv_cmd)
|
|
|
|
|
|
@task
|
|
def setup():
|
|
"""
|
|
install all packages via pip
|
|
"""
|
|
configuration = env.config
|
|
|
|
if env.debug:
|
|
logging.basicConfig(
|
|
format='\n%(levelname)s: deploy.pip %(message)s',
|
|
level=logging.DEBUG)
|
|
|
|
pipinstall_cmd = "pip install -r {requirements}".format(
|
|
requirements=configuration.virtualenv.requirements)
|
|
|
|
if env.debug:
|
|
logging.debug("with virtualenv(): run(\"\n\t%s\n\t\")" %
|
|
pipinstall_cmd)
|
|
else:
|
|
with virtualenv():
|
|
run(pipinstall_cmd)
|
|
|
|
|
|
@task
|
|
def install(package=None):
|
|
"""
|
|
install a packages via pip
|
|
"""
|
|
configuration = env.config
|
|
|
|
import sys
|
|
|
|
if not package:
|
|
print_console("you must specify a package to be installed")
|
|
sys.exit()
|
|
|
|
if package == "--all":
|
|
pipinstall_cmd = "pip install -r {requirements_file}".format(
|
|
requirements_file=configuration.virtualenv.requirements)
|
|
else:
|
|
pipinstall_cmd = "pip install {package}".format(
|
|
package=package)
|
|
|
|
if env.debug:
|
|
print_console("pipinstall_cmd : %s" % pipinstall_cmd)
|
|
|
|
else:
|
|
with virtualenv():
|
|
run(pipinstall_cmd)
|
|
|
|
|
|
@task
|
|
def freeze(param=False):
|
|
configuration = env.config
|
|
|
|
msg_help = """
|
|
pip.freeze takes one of three values:
|
|
\thelp - this help message
|
|
\tTrue - update the pip package list the freeze output
|
|
\tFalse (default) - print the freeze output to the console
|
|
"""
|
|
|
|
from utils import booleanize, handle_help
|
|
import sys
|
|
|
|
if handle_help(param, msg_help, 'help'):
|
|
sys.exit()
|
|
else:
|
|
try:
|
|
param = booleanize(param)
|
|
except TypeError:
|
|
print "the parameter value you gave, \"%s\" , is not" \
|
|
" a valid parameter." % param
|
|
print msg_help
|
|
sys.exit()
|
|
|
|
if param:
|
|
cmd_pipfreeze = "pip freeze > {requirements}".format(
|
|
requirements=configuration.virtualenv.requirements)
|
|
else:
|
|
cmd_pipfreeze = "pip freeze"
|
|
|
|
with virtualenv():
|
|
run(cmd_pipfreeze)
|