Exemple #1
0
 def handle(self, *test_labels, **options):
     from thepian.conf import structure
     nginx.nginx_installed()
     
     if exists(self.nginx_plist):
         os.system('sudo launchctl load -w %s' % self.nginx_plist)
     else:
         print 'Cannot determine server control method'
Exemple #2
0
    def handle(self, *modulenames, **options):
        #TODO make sure memcached couchdb are started
        try:
            # is this needed? fs.symlink(structure.SCRIPT_PATH,'/usr/local/bin/maestro',replace=True)
            nginx_installed()
            #TODO create <project>/log dir for nginx 
            structure.ensure_target_dirs()
            structure.machine.uploads_area.require_directory(structure.UPLOADS_DIR)
            structure.machine.downloads_area.require_directory(structure.DOWNLOADS_DIR)
            structure.machine.log_area.require_directory(structure.LOG_DIR)
            structure.machine.pid_area.require_directory(structure.PID_DIR)
            #sock_dir = "/var/tmp/django"
            #import fs,os,stat
            #fs.makedirs(sock_dir)
            #os.chmod(sock_dir,0777)

            if settings.DEVELOPING:
                #TODO link in User Sites directory
                from os.path import join,exists,expanduser
                fs.symlink(structure.PROJECT_DIR,join(expanduser("~/Sites"),structure.PROJECT_NAME))
                hosts = updated_hosts(change_file=True)
    
                dev_name = join(structure.CONF_DIR,"dev.nginx.conf")
                if not exists(dev_name):
                    servers_contents = nginx_enabled(cluster_name="dev",release_project_dir=False)
                    with open(dev_name, 'w') as nginx_conf:
                        nginx_conf.writelines(servers_contents)               
                dev_name = join(structure.CONF_DIR,"staged.nginx.conf")
                if not exists(dev_name):
                    servers_contents = nginx_enabled(cluster_name="staged",release_project_dir=False)
                    with open(dev_name, 'w') as nginx_conf:
                        nginx_conf.writelines(servers_contents)

            symlink_local_nginx()
        except Warning, e:
            print self.style.NOTICE(e.message)