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))
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
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()))