def install_uwsgi(self):
if self.args.force or prompt(red(' * Install Uwsgi service (y/n)?'), default='y') == 'y':
sudo('pip3 install uwsgi')
# uwsgi config need real env path
with cd(self.python_env_dir):
real_env_path = run('pwd')
# get user
home_user = run('echo $USER')
# uwsgi config string
django_uwsgi_ini = self.django_uwsgi_ini.format(self.nginx_web_dir, self.project, real_env_path, home_user)
# modify uwsgi config file
with cd(self.project_dir):
if not exists('{0}.ini'.format(self.project)):
run('touch {0}.ini'.format(self.project))
put(StringIO(django_uwsgi_ini), '{0}.ini'.format(self.project), use_sudo=True)
print(green(' * Installed Uwsgi service in the system.'))
print(green(' * Done '))
print()
评论列表
文章目录