我需要为一个简单的网站使用网络框架吗?

发布于 2024-12-07 10:24:15 字数 83 浏览 1 评论 0原文

该网站不会那么复杂,并且类似于现代博客(用户、消息、新闻和其他类似功能)。
我是否需要为此使用框架?如果需要,哪个最好?
金字塔,姜戈?

The site won't be that complicated and will resemble a modern blog (users, messages, news and other similar features).
Do I need to use a framework for this, and if so, which is best?
Pyramid, Django?

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

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

发布评论

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

评论(4

人生戏 2024-12-14 10:24:15

您当然不需要网络框架来创建一个简单的网站。鉴于您是 python 新手并且对构建 python 网站感兴趣,我想这意味着:您对学习 python 感兴趣。当然,如果您只对学习 django-python 感兴趣,那么您没有理由不能跳入 django,正如 Ronak 所说。他是对的。它有很多文档。但它会给 Python 带来一些奇怪的介绍。

如果我是你,我要么先开始制作一些离线程序,要么考虑一个超轻量级的框架。许多人会提倡 web2py 或金字塔来实现超轻量级。我可能会考虑变得更轻。像 Bottle 这样的东西,你或多或少只是将函数与 url 配对。这样你至少可以做一些黑客/试错,而不是直接启动到 django。

这并不是说 django 不使用 python——它会多次告诉你它实际上“只是 python”。但它的核心是适应大型商业环境(我认为是芝加哥或其他在线网站)。因此,它强制执行各种规则,这些规则有助于管理一起参与项目的许多不同员工。您可能希望也可能不希望获得这种“帮助”。这也意味着项目的规模被假定为很大,并且时间范围是无限的。如果您想了解 python 字典是如何工作的,您可能不想花费很长时间配置设置并创建数据库所需的伪静态类型等,只是为了执行项目并查看结果。

我意识到我会因此自动被否决,但我相信这是合理的建议。

You certainly don't need a webframework to create a simple website. Given that you're new to python and interested in building a python website, I imagine this implies: you're interested in learning python. If you're exclusively interested in learning django-python, there's no reason you can't jump in to django, as Ronak said, of course. He's right. It has a lot of documentation. But it will make for somewhat of an odd intro to python.

If I were in your shoes, I'd either start making some offline programs first, or consider an ultra-lightweight framework. Many would advocate web2py or pyramid for ultralightweight. I might consider going even lighter. Something like Bottle, where you're more or less just pairing functions with urls. This way you can at least do a bit of hacking/trial-and-error, instead of launching right into django.

It's not that django doesn't use python-- it will tell you many times that it is in fact 'just python.' But it's adapted at its core to be used in a large business setting (the chicago something or other online, i think). So it enforces various rules that are helpful in managing many different employees working on a project together. You may or may not wish for this kind of 'help.' It also means the scale of projects is assumed to be large and the time-horizon, limitless. If you want to see how a python dictionary works, you may not want to spend a long time configuring settings and creating the pseudo-static-typing you need for your database, and so on, just to execute your project and see a result.

I realize I will automatically get downvoted for this, but I believe it to be sound advice.

遮云壑 2024-12-14 10:24:15

这取决于您计划建立什么样的网站。如果网站只是一组静态 HTML 文件,那么您实际上并不需要框架。但是,如果您的网站有大量定期更新的动态内容,您应该使用一些框架。这将使您维护网站的生活变得更加简单。

Django 是用 Python 编写的最流行的框架。它拥有非常好的文档和强大的社区基础。

It depends on what kind of website you are planning to come up with. If the website is going to be just a set of static HTML files, then you don't really need a framework. But if your website will have lots of dynamic content that will get updated on regular basis, you should go with some framework. That will make your life maintaining the website much more simpler.

Django is the most popular framework written in Python. It has very good documentation and a strong community base too.

讽刺将军 2024-12-14 10:24:15

跟着姜戈走吧——一万名猫王粉丝不会错的。

或者从头开始自己开发。您将学到很多东西,了解有关网站如何工作的一切,并更好地理解框架为您所做的事情。

Go with Django - 10,000 Elvis fans can't be wrong.

Or roll your own from scratch. You'll learn a lot, know everything about how you site works, and better appreciate what a framework does for you.

洒一地阳光 2024-12-14 10:24:15

正如 RonakG 首先指出的那样,这完全取决于您打算建立和运行的网站类型。事实上,你的问题太笼统,无法给出一个明确的答案。除了使用 python 之外,还有更多方面需要考虑。例如,截止日期。这意味着要考虑实现结果的学习曲线。如果您没有太多时间,那么陡峭的学习曲线(为了发展它而学习它的时间)肯定是您想要避免的。也许您已经用其他语言进行开发,并且需要集成和/或迁移支持,需要可扩展性、可重用性等等。

您的问题中不太清楚的另一件事是您所说的“网站赢得了”没那么复杂,类似于现代博客(用户、消息、新闻和其他类似功能)”。如果它确实类似于一个现代博客,包含用户、消息和新闻,您可以在 google 上搜索 CMS(内容管理系统)。有许多可用选项,可以让您几乎立即启动并运行您的网站。您所需要学习的就是如何自定义它所必须的任何内容以满足您的需求。

也就是说,如果您更喜欢 Python,可以使用一些不错的 CMS 来快速开发您的网站,例如 Plone。如果您更喜欢 Django,可以选择 Django CMS 和优秀的 Pinax 项目,该项目利用 django 代码的可重用性为您提供完全可定制的完整网站示例。

As RonakG first pointed, it all depends on the kind of website you intend to have up and running. Actually, your question is too general for a single, definitive answer. There are more aspects to consider other than just being in python. For example, deadlines. This means considering the learning curve to achieve your results. If you don't have much time, a steep learning curve (time to learn it in order to develop it) is certainly something you will want to avoid. Perhaps you already develop in other languages, and need integration and/or migration support, need scalability, reusability, etc, etc, etc.

Another thing that is not so clear in your question is what you mean by "The site won't be that complicated and will resemble a modern blog (users, messages, news and other similar features)". If it really resembles just a modern blog, with users, messages and news, you could google for CMS (Content Management Systems). There are many options available, that could make you have your site up and running in almost no-time. All you'll have to learn is how to customize whatever it has to as to comply to your needs.

That said, if you prefer python, there are some good CMSs available which you can develop your site fast, like Plone. And if you prefer Django, there's Django CMS and there's the excellent Pinax project, which takes the django code reusability to deliver you sample fully customizable, complete websites.

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