Exemplo n.º 1
0
    def configure_webserver(self, name, config, delete_other_sites=False):
        if delete_other_sites:
            with cuisine_sudo():
                clear_dir('/etc/apache2/sites-enabled')

        with cuisine_sudo():
            cuisine.file_write('/etc/apache2/sites-enabled/%s' % name, config)
            print("Apache configured\n%s" % config)
Exemplo n.º 2
0
    def configure_virtualenv(self):
        # configure virtualenv - we don't need it for WSGI, however, it's required for ./manage.py and django-admin.py
        if self.use_virtualenv:
            activate_file_name = path(self.virtualenv_path).joinpath(self.virtualenv_name).joinpath('bin/activate')
            activate_text = file_read(activate_file_name)
            new_activate_text = text_ensure_line(activate_text,
                'export DJANGO_SETTINGS_MODULE="%s"' % self.settings_module)

            if new_activate_text != activate_text:
                file_write(activate_file_name, unix_eol(new_activate_text))
Exemplo n.º 3
0
    def configure_webserver(self, name, config, delete_other_sites=False):
        if delete_other_sites:
            with cuisine_sudo():
                clear_dir('/etc/apache2/sites-enabled')

        with cuisine_sudo():
            cuisine.file_write('/etc/apache2/sites-enabled/%s' % name, config)
            run("ln -fs /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load")
            run("ln -s /etc/apache2/mods-available/ssl.load /etc/apache2/mods-enabled/ssl.load")

            print("Apache configured\n%s" % config)
Exemplo n.º 4
0
    def set_debug(self, debug):
        with cuisine_sudo():
            settings_file_path = path(self.src_root).joinpath(self.settings_module.replace(".", "/") + ".py")
            settings_content = cuisine.file_read(settings_file_path)

            # replaces "#listen_addresses = 'localhost'	" type of lines
            # with "listen_addresses = '*'"
            settings_content, replaced = text_replace_line_re(settings_content, "^DEBUG\s*=", "DEBUG=%s" % debug)

            return cuisine.file_write(settings_file_path, unix_eol(settings_content)), replaced
Exemplo n.º 5
0
 def configure_wsgi(self):
     wsgi_handler = self.create_wsgi_handler()
     cuisine.file_write(self.wsgi_handler_path, wsgi_handler)
     print(wsgi_handler)
Exemplo n.º 6
0
 def configure(self, enable_remote_access=False):
     if enable_remote_access:
         with cuisine_sudo():
             cuisine.file_write(self.pg_hba_path(), unix_eol(self.process_pg_hba_conf()))
             cuisine.file_write(self.postgresql_conf_path(), unix_eol(self.process_postgresql_conf()))