在 ec2 上安装我的 Django 应用程序
我正在 ec2 上启动 Django 应用程序,但在尝试在 AMI 实例上安装代码时遇到了困难。这是我的情况:我有一个 bitnami AMI 正在运行,其中预装了 Django、apache、Postgresql 和几乎所有我的依赖项,并且我的功能齐全的 Django 应用程序在我的本地计算机上运行,到目前为止我一直在测试它Django 开发服务器。经过大量谷歌搜索后,将应用程序安装到 ec2 实例的最常见方法似乎是使用 ssh/sftp/scp 将 tarball 放入实例中,或者创建存储库并从那里导入代码。如果有人可以告诉我他们喜欢的方法,并指导我完成整个过程,或者提供一个好的教程的链接,我将不胜感激!
Im in the process of launching a Django app on ec2, but have hit a wall trying to install my code on my AMI instance. This is my situation: I have a bitnami AMI up and running that has Django, apache, Postgresql, and nearly all my dependancies pre installed, and I have my fully functional Django app running on my local machine that I have been testing thus far with the Django Dev server. After quite a bit of googling, the most common methods of installing an app to an ec2 instance seem either using ssh/sftp/scp to drop a tarball in the instance, or creating a repository and importing code from there. If anyone can tell me the method they prefer, and guide me through the process, or provide a link to a good tutorial, it would be hugely appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我通常只需 scp -R 将整个站点目录复制到 AMI 的 /home/bitnami 中。我正在使用 Apache/NGINX/Django 和 mod_wsgi。因此,根据 apache cfg 文件中的 mod_wsgi 路径引用该目录(例如 /home/bitnami/djangosites/)。
换句话说,为什么不递归地移动整个目录(scp -R)而不是制作 tarball 等?
I usually simply scp -R my whole site directory into /home/bitnami of my AMI. I'm using Apache/NGINX/Django with mod_wsgi. So the directory (for example /home/bitnami/djangosites/) gets referred to based on my mod_wsgi path in my apache cfg file.
In other words, why not just move the whole directory recursively (scp -R) instead of making a tarball etc?
直接复制你的项目所在的文件夹就可以了。不过,您提到您正在使用 BitNami 映像,因此您可能正在使用 BitNami Django Stack Amazon 映像。 BitNami 还提供了 BitNami Django Stack 的本机版本,因此我建议您首先尝试部署应用程序在本机安装程序之上,查看您需要遵循的具体步骤。例如,您可能需要安装 python 依赖项,或者如果您计划在生产中使用 Apache 而不是 Django 开发服务器,您将需要配置 Apache 来为您的项目提供服务。我是一名 BitNami 开发人员,我提到这一点是因为让不同平台(包括 ec2)中的部署变得更容易是 BitNami 的目标之一,并且当您已经在使用它时,您可以利用这一点。
Directly copy the folder where your project resides may work. However you mention that you are using a BitNami image, so it is likely that you are using the BitNami Django Stack Amazon image. BitNami also provides a native version of the BitNami Django Stack so I would suggest that you first try to deploy your application on top of the native installer and see what exact steps you need to follow. For instance you may need to install python dependencies or if you plan to use Apache on production instead of the Django development server you will need to configure Apache to serve your project. I'm a BitNami developer and I mention this because make easier the deployment in different platforms (including ec2) is one of the goal of BitNami and as you are already using it you can take advantage of this.