[英]How do i run two command lines in AWS simultaneously?
I have a Django app that I am trying to deploy to AWS. 我有一个Django应用程序,我正在尝试部署到AWS。 I need two command lines to run the app. 我需要两个命令行来运行应用程序。 One command line will be used to runserver and another one to run a background task. 一个命令行将用于runserver,另一个命令行用于运行后台任务。 That is how the app runs in my localserver. 这就是应用程序在我的本地服务器中运行的方式。
How do I start two command lines in AWS? 如何在AWS中启动两个命令行?
As i can understand your django app is currently in development mode, I've used tmux
for development mode, this page will guide you better to use tmux. 我可以理解您的django应用程序目前处于开发模式,我已经将tmux
用于开发模式,此页面将指导您更好地使用tmux。 Once you have started a tmux session run python3 manage.py runserver
and then detach to the session using ctrl-b
then press d
and now your app will run even after you exit the shell. 启动tmux会话后,运行python3 manage.py runserver
,然后使用ctrl-b
分离到会话,然后按d
,现在即使退出shell,您的应用程序也会运行。
To know more about tmux go through this page . 要了解有关tmux的更多信息,请浏览此页面 。
In case you have to run your app in production mode Don't use above method, run your app with any of nginx
or apache2
server. 如果您必须在生产模式下运行您的应用程序不要使用上述方法,请使用任何nginx
或apache2
服务器运行您的应用程序。 This tutorial can guide you to set up your django app with nginx and gunicorn. 本教程可以指导您使用nginx和gunicorn设置django应用程序。
Supervisor is a good way to control that. 主管是控制它的好方法。 You can run a lot of processes (like server, migration, collectstatic, Celery) easily. 您可以轻松地运行许多流程(如服务器,迁移,collectstatic,Celery)。
Additionally, you can ensure that all processes will run again when your machine reboots. 此外,您可以确保在计算机重新启动时所有进程都会再次运行。
And, as everybody said, you have to install a server in production that supports WSGI in order to run Django properly. 并且,正如大家所说,你必须在生产中安装支持WSGI的服务器才能正确运行Django。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.