从运行服务器迁移到生产服务器

发布于 2024-11-17 16:08:18 字数 237 浏览 3 评论 0原文

我对编程很陌生,我的所有开发都是使用 textmate 和终端在本地运行服务器上进行的。我写了一个有几百个的小应用程序,我想将它推送到 EC2 服务器。我对“开发工具”的唯一了解是 Django 的本地运行服务器、TextMate 和 Terminal。

我应该学习哪些工具或程序才能拥有有效的工作流程?为此我是否应该使用某种 IDE 而不是 TextMate?我主要关心的是能够在本地运行服务器上进行开发,然后轻松地将其推送到我的生产服务器。

I am quite new to programming, and all of my development has been on my local runserver using textmate and terminal. I have written a small app with a few hundred and I'd like to push it to an EC2 server. My only knowledge in terms of 'developing tools' is Django's local runserver, TextMate and Terminal.

What tools or programs should I look into learning to be able to have an effective workflow?Should I be using some sort of IDE over TextMate for this? My main concerns are being able to develop on my local runserver and then painlessly push that to my production server.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

就像说晚安 2024-11-24 16:08:18

正如@isbadawi所说,使用Fabric。它比仅使用终端更好,因为您可以自动化操作。就部署而言,您可以将其简化为:fab -H your.host.com deploy。在您编写命令的文件中,可能会出现一个简单的命令:

  1. 导致服务器从 SCM 下载最新的代码
  2. 更新数据库(syncdb / 迁移 / 你有什么)
  3. 导致 apache 或您使用的任何内容重新加载配置

到目前为止正如一些更一般的提示:

  • 如果您使用 WSGI,请将其置于源代码控制之下
  • 同样适用于本地设置文件,让您的部署脚本将它们重命名为 local_settings.py 作为构建的一部分

如果您真的很想去轻松地,查看 Django 托管服务,例如 GondorEp.io。这些客户端将具有您可以伪轻松地部署到的客户端,尽管您必须更改自己的一些设置以更好地匹配它们,因为部署 Django 应用程序的方法有很多。

更新:Ep.io 不再作为托管服务开展业务。我的新选择是 Heroku

更新 2: 我曾经在部署中链接 local_settings.py,但现在我倾向于使用 DJANGO_SETTINGS_MODULE 配置变量。请参阅 rdegge 的“django-skel”设置,了解一个好方法做这个。

As @isbadawi said, use Fabric. It's better than just using the terminal because you can automate things. As far as deployments go, you can simplify it down to: fab -H your.host.com deploy. Inside the file you write commands, a simple one might go:

  1. Cause the server to download the most recent code from SCM
  2. Update the database (syncdb / migrations / what have you)
  3. Cause apache or whatever you're using to reload the configuration

As far as some more general tips go:

  • If you're using WSGI, put it under source control
  • Same goes with local settings files, have your deploy script rename them to local_settings.py as part of the build

If you're really going for painless, look into Django hosting services like Gondor or Ep.io. Those will have clients that you can just deploy to pseudo-painlessly, although you will have to change some settings on your side to match theirs better, as there are many many ways to deploy a Django app.

Update: Ep.io is no longer in business as a hosting service. My new go-to is Heroku.

Update 2: I used to link local_settings.py in deployments, but now I'm leaning towards using the DJANGO_SETTINGS_MODULE config variable. See rdegge's "django-skel" settings for a good way to do this.

如梦初醒的夏天 2024-11-24 16:08:18

诸如 git 或 Mercurial 之类的 DVCS 允许您在本地开发和测试,然后将更改推送到远程系统以进行登台和生产。

A DVCS such as git or Mercurial will allow you to develop and test locally, and then push the changes to a remote system for staging and production.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文