关于创建独立项目以及使用源代码分发 Web 服务器的建议
我需要一些有关配置项目的建议,以便它可以在开发、暂存和生产环境中运行:
我有一个 Web 应用程序项目 MainProject,其中包含两个子项目 ProjectA 和 ProjectB,以及一些通用代码 Common。它位于 Subversion 存储库中。它几乎都是 HTML、CSS 和 JavaScript。
在我们当前的开发环境中,我们检查 MainProject,然后设置 Apache 虚拟主机以指向每个子项目的目录,因为每个项目内的路径都相对于其根目录。我们还有一个构建过程,然后将每个子项目编译成自己的可交付包,并将公共代码复制到每个子项目中。
所以 - 我正在努力让这个项目的开发变得更容易一些。目前,Apache http.conf 文件、build.xml 文件以及其他几个地方也有很多文件路径配置。
理想情况下,我希望将项目从 SVN 签出到一台新计算机上,并将 Web 服务器作为项目的一部分,进行完全配置,然后可以从签出目录运行,只需很少的额外配置,无论是在 PC 上或麦克。我希望任何人都能够运行该构建来编译它。
我很想听听做过类似事情的人的意见,以及您的任何建议。
谢谢, 保罗
I need some advice on configuring a project so it works in development, staging and production environments:
I have a web app project, MainProject, that contains two sub-projects, ProjectA and ProjectB, as well as some common code, Common. It's in a Subversion repository. It's nearly all HTML, CSS and JavaScript.
In our current development environment we check MainProject out, then set up Apache virtual hosts to point at each of the sub-project's directories, as paths within each project are relative to their root. We also have a build process that then compiles each of the sub-projects into their own deliverable package, with the common code copied into each.
So - I'm trying to make development of this project a bit easier. At the moment there is a lot of configuration of file paths in Apache http.conf files, as well as the build.xml file and in a couple of other places too.
Ideally I'd like the project to be checked out of SVN onto a fresh computer, with a web server as part of the project, fully configured, that can then be run from the checkout directory with very little extra configuration, either on a PC or Mac. And I'd like anyone to be able to run the build to compile it too.
I'd love to hear from anyone who has done something like this, and any advice you have.
Thanks,
Paul
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果你可以添加 python 作为依赖项,你就可以用不到十行代码来运行一个最小的 HTTP 服务器。如果您有基本的服务器端代码,那么还有一个 CGI 服务器。
以下代码片段直接从 BaseHTTPServer 文档复制
If you can add python as a dependency, you can get a minimal HTTP server running in less than ten lines of code. If you have basic server side code, there is a CGI server as well.
The following snippet is copied directly from the BaseHTTPServer documentation
我已经在 Java 中使用 Jetty 完成了这项工作。基本上你编写一个简单的Java类来启动Jetty(这是一个小型Web服务器) - 你可以通过ant任务运行它(我将它与自动化测试一起使用 - Java代码向服务器发出请求并检查各种结果方式)。
不确定它在这里是否合适,因为你根本没有提到 Java,所以如果它不是你正在寻找的东西,我深表歉意。
I've done this with Jetty, from within Java. Basically you write a simple Java class that starts Jetty (which is a small web server) - you can make then this run via an ant task (I used it with automated tests - Java code made requests to the server and checked the results in various ways).
Not sure it's appropriate here because you don't mention Java at all, so apologies if it's not the kind of thing you're looking for.