def syncdb(): '''Synchronizes the Django database tables''' with cd('$HOME/.virtualenvs/openclimategis/src/openclimategis/src/openclimategis' ): with virtualenv(): # suppress input prompting for a superuser run('./manage.py syncdb --noinput')
def register_archive_usgs_cida_maurer(): '''Register the USGS CIDA Maurer et al. downscaled archive''' with cd('$HOME/.virtualenvs/openclimategis/src/' + \ 'openclimategis/src/openclimategis'): with virtualenv(): run('./manage.py register_archive' + \ ' http://cida.usgs.gov/qa/thredds/dodsC/maurer/monthly')
def install_pykml(): '''Install pyKML and dependencies''' from virtualenv import virtualenv sudo('apt-get -y install libxml2') sudo('apt-get -y install libxslt1.1 libxslt-dev') with virtualenv(): run('pip install pykml')
def main(): domain = "" project = "" project_type = '' estrue = True while(domain==""): domain = raw_input("\033[92mDominio (Sin www):\033[0m ") while(project==""): project = raw_input("\033[92mNombre del proyecto:\033[0m ") while estrue: project_type = raw_input("\033[92mTipo de proyecto\n" "--> python\n" "--> php\n" "Pon uno de los tipos permitidos:\033[0m ") if project_type == "php": estrue = False if project_type =="python": estrue = False #Comprobamos si nginx esta instalado nginx_check() #Llamamos al modulo de usuario user(project) dirweb(project) if project_type == "python": #Comprobamos si esta instalado supervisor supervisor_check() #Comprobamos si esta instalado virtualenv o virtualenvwrapper virtualenv_check() #Al ser python creamos una virtualenv para el proyecto virtualenv(project) #Llamamos la modulo de nginx nginx_main(domain, project, project_type) #si el projecto esta en python, llamamos a supervisor para generar la configuracion if project_type == "python": supervisor_conf(project)
def install_python_dependencies(): '''Install required Python packages''' from virtualenv import VIRTUALENVDIR from virtualenv import VIRTUALENVNAME from virtualenv import VIRTUALENVWRAPPER_ACTIVATE from virtualenv import virtualenv sudo('apt-get -y install python-dev') sudo('apt-get -y install python-setuptools') sudo('apt-get -y install python-pip') sudo('pip install virtualenv') sudo('pip install virtualenvwrapper') with settings(warn_only=True): run('mkdir ' + VIRTUALENVDIR) # create the Python virtual environment with prefix(VIRTUALENVWRAPPER_ACTIVATE): run('mkvirtualenv --no-site-packages ' + VIRTUALENVNAME) # install symbolic link in the virtual environment to GDAL with settings(warn_only=True): run('ln -s ' + GDAL_DIR + '/bin/gdal-config ' + \ '~/.virtualenvs/' + VIRTUALENVNAME + '/bin/gdal-config') with virtualenv(): run('pip install yolk') run('pip install Django==1.3') run('pip install django-piston') run('pip install -e hg+https://bitbucket.org/tylere/django-piston#egg=piston' ) run('pip install numpy==1.5.1') run('pip install Shapely') run('pip install geojson') run('pip install geoalchemy') with prefix('export HDF5_DIR=' + HDF5_DIR): with prefix('export NETCDF4_DIR=' + NETCDF4_DIR): run('pip install netCDF4==0.9.4') # install the GDAL Python bindings run('pip install --no-install GDAL') # build package extensions with cd('$HOME/.virtualenvs/' + VIRTUALENVNAME + '/build/GDAL'): run('python setup.py build_ext' + \ ' --gdal-config=' + GDAL_DIR + '/bin/gdal-config' + \ ' --library-dirs=' + GDAL_DIR + '/include') run('pip install --no-download GDAL')
def install_python_dependencies(): '''Install required Python packages''' from virtualenv import VIRTUALENVDIR from virtualenv import VIRTUALENVNAME from virtualenv import VIRTUALENVWRAPPER_ACTIVATE from virtualenv import virtualenv sudo('apt-get -y install python-dev') sudo('apt-get -y install python-setuptools') sudo('apt-get -y install python-pip') sudo('pip install virtualenv') sudo('pip install virtualenvwrapper') with settings(warn_only=True): run('mkdir ' + VIRTUALENVDIR) # create the Python virtual environment with prefix(VIRTUALENVWRAPPER_ACTIVATE): run('mkvirtualenv --no-site-packages ' + VIRTUALENVNAME) # install symbolic link in the virtual environment to GDAL with settings(warn_only=True): run('ln -s ' + GDAL_DIR + '/bin/gdal-config ' + \ '~/.virtualenvs/' + VIRTUALENVNAME + '/bin/gdal-config') with virtualenv(): run('pip install yolk') run('pip install Django==1.3') run('pip install django-piston') run('pip install -e hg+https://bitbucket.org/tylere/django-piston#egg=piston') run('pip install numpy==1.5.1') run('pip install Shapely') run('pip install geojson') run('pip install geoalchemy') with prefix('export HDF5_DIR=' + HDF5_DIR): with prefix('export NETCDF4_DIR=' + NETCDF4_DIR): run('pip install netCDF4==0.9.4') # install the GDAL Python bindings run('pip install --no-install GDAL') # build package extensions with cd('$HOME/.virtualenvs/' + VIRTUALENVNAME + '/build/GDAL'): run('python setup.py build_ext' + \ ' --gdal-config=' + GDAL_DIR + '/bin/gdal-config' + \ ' --library-dirs=' + GDAL_DIR + '/include') run('pip install --no-download GDAL')
def install_openclimategis_django(): '''Install OpenClimateGIS GeoDjango project''' with virtualenv(): run('pip install -e git+http://github.com/tylere/OpenClimateGIS#egg=openclimategis')
def install_psycopg2(): '''Install the Python PostgreSQL database adapter''' with virtualenv(): run('pip install psycopg2==2.4')
def dj(cmd): with cd(config['path']): with virtualenv(config): settings_path = config['settings_path'] config.func('python manage.py %s --settings %s' % (cmd, settings_path))
def create_superuser(): '''Creates a Django superuser that can log into the Django admin''' with cd('$HOME/.virtualenvs/openclimategis/src/openclimategis/src/openclimategis'): with virtualenv(): run('./manage.py createsuperuser')
def update_openclimategis_django(): '''Update the OpenClimateGIS GeoDjango project''' with virtualenv(): with cd(VIRTUALENVDIR + VIRTUALENVNAME + '/src/openclimategis'): run('git pull')
def install_openclimategis_django(): '''Install OpenClimateGIS GeoDjango project''' with virtualenv(): run('pip install -e git+http://github.com/tylere/OpenClimateGIS#egg=openclimategis' )
def pull(): with cd(config['path']): with virtualenv(config): config.func('git pull') touch()
def vsh(cmd): with cd(config['path']): with virtualenv(config): config.func(cmd)
def sq_up(package): with virtualenv(config): config.func('pip install --upgrade -e git+ssh://[email protected]/sevenquark/%s.git#egg=%s' % (package, package))
def syncdb(): '''Synchronizes the Django database tables''' with cd('$HOME/.virtualenvs/openclimategis/src/openclimategis/src/openclimategis'): with virtualenv(): # suppress input prompting for a superuser run('./manage.py syncdb --noinput')
def start(): with virtualenv(config): local('python manage.py runserver')
def create_superuser(): '''Creates a Django superuser that can log into the Django admin''' with cd('$HOME/.virtualenvs/openclimategis/src/openclimategis/src/openclimategis' ): with virtualenv(): run('./manage.py createsuperuser')
def req_up(): with virtualenv(config): if exists(config.func, 'config/requirements.txt'): config.func('pip install --upgrade -r config/requirements.txt')