我对开发还是很陌生...
我想简化django-friendship并添加一些不同的功能。我已经在 GitHub 上 fork 了它。我不确定下一步该做什么。
我的 django-friendship
存储库的本地副本应该放在哪里?
我应该将它作为一个应用程序集成到我当前的 Django 项目中,还是将其设置为一个单独的项目?在这种情况下,如何设置我的主要 Django 项目以在开发时将其用作应用程序?
我将不胜感激我可以从这里学到的任何指导或其他资源。
谢谢!
最佳答案
有几个选项可供您选择:
直接从Github安装
将以下内容(替换为您的分支存储库)添加到 requirements.txt
文件或直接使用 pip install
安装:
git+git://github.com/revsys/django-friendship.git#egg=django-friendship
这会将您的存储库副本下载到您的 Python 环境中。但是,如果您对存储库进行了更改,则每次推送更改时都需要重新安装它。
下载本地副本并安装
这个方法更简洁:
// Clone the repository locally
git clone https://github.com/revsys/django-friendship.git
// cd into the project folder
cd django-friendship
// Install the package into your python environment
// The `-e` tells pip this package is editable
pip install -e .
项目现已直接链接。您现在可以在本地处理 fork 存储库,更改将立即对您的应用可用。
在您的 requirements.txt
文件中,您需要添加以下内容以便稍后部署:
git+git://github.com/revsys/django-friendship.git#egg=django-friendship
查看 pip 的文档有关依赖管理的更多信息。
关于python - Django 1.8 : How do I use my first 3rd Party Fork with my current project?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31916958/