Django 应用程序合并流程

发布于 2024-08-06 07:16:35 字数 103 浏览 2 评论 0原文

有人可以强调一下,在不使用 setup.py 的情况下将可重用的 django 应用程序合并到项目中应该是怎样的过程吗?

我们可以简单地将应用程序移动到项目目录并开始使用它吗?

Can some one please highlight what should be the process of incorporating reusable django app in a project without using setup.py.

Can we simply move app into project directory and start using it?

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

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

发布评论

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

评论(2

勿忘心安 2024-08-13 07:16:35

只要它在 sys.path 上,Django 就会找到它。是的,您可以将其移动到项目目录中。

As long as it's on sys.path, it will be found by Django. And yes, you can move it to project's directory.

天气好吗我好吗 2024-08-13 07:16:35

补充一点:如果您非常确定您只会使用某个应用程序一次,那么最简单的方法是将其放入项目目录中;但是,我发现对于我多次使用的应用程序,放入 sys.path 会更容易(如上所述)。

由于大多数应用程序都可以通过 svn 或 git 获取,因此我倾向于通过这种方式获取源代码(主干),然后创建一个符号链接到我的站点包文件夹(位于 sys.path 上)。这样我就可以继续在此文件夹中提取应用程序的更新。

我也用 django trunk 来做这个。

例如,我有:~/src/django-notification~/src/django-trunk。然后我象征性地链接到我的 python 路径。

sudo ln -s ~/src/django-notification/notification /usr/lib/python2.5/site-packages/notification

这样我的所有项目都可以轻松导入应用程序,并且我可以继续获取更新。

To add to that: if you are pretty sure you are only going to use an app once, it may be easiest just to drop it in the project directory; however, I have found that for apps I use more than once, it is easier to put in the sys.path (as mentioned).

Since most apps are availabale via svn or git, I tend to grab the source (trunk) this way, and then create a symbolic link into my site-packages folders (which is on sys.path). This way I can continue to pull updates to the app in this folder.

I do this with the django trunk as well.

For example, I have: ~/src/django-notification and ~/src/django-trunk. And I have then symbolically linked onto my python path.

sudo ln -s ~/src/django-notification/notification /usr/lib/python2.5/site-packages/notification

This way all my projects can import the app easily and I can continue to get updates.

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