如何将virtualenv设置为在主机服务器上保持活动状态



我创建了一个网站,它使用vuejs作为前端,django作为后端,另一个服务在我调用api的所有东西后面运行。

因此,django的设置方式是查看Vuejs的dist文件夹,并在运行manage.py runserver时为其提供服务。但问题是我创建的服务也在python中,它需要在virtualenv中运行才能工作(它使用tensorflow 1.15.2,这只能在包含的环境中运行(

我坐在这里,想知道如何部署django应用程序并保持virtualenv的活动状态,但我一无所获,我试着对此进行了一些研究,但我发现的一切都与我的问题无关。我已经部署了它,当我关闭ssh连接时,virtualenv就会停止。

如果有人能启发我的方法,我将不胜感激

我认为您需要nginx:https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04

如果你只是在终端中搜索保留状态,我建议tmuxhttps://github.com/tmux/tmux/wiki

您可以使用uWSGI和nginx在服务器上部署Django应用程序。以下是有用的文章:

https://www.digitalocean.com/community/tutorials/how-to-set-up-uwsgi-and-nginx-to-serve-python-apps-on-centos-7https://www.digitalocean.com/community/tutorials/how-to-set-up-uwsgi-and-nginx-to-serve-python-apps-on-centos-7

Django官方文档也有一个关于它的页面:https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/uwsgi/

有一些来自开发人员的文章,所以你可以参考它们,以防你被困在任何地方:

https://www.freecodecamp.org/news/django-uwsgi-nginx-postgresql-setup-on-aws-ec2-ubuntu16-04-with-python-3-6-6c58698ae9d3/

https://medium.com/@biswashirok/部署-djano-python-3-6到数字海洋与-uwsgi-nginx-ubuntu-18-04-3f8c2731ade1

最新更新