在django项目的开发和部署过程中简化许多任务的fab文件。
django-development-fabfile的Python项目详细描述
在django的开发和部署过程中简化许多任务的fabfile 项目。
安装
只需将django-development-fabfile添加到requirements.txt并 通过pip install -r requirements.txt安装。
然后在项目根目录(通常是 您的manage.py文件存在:
fabfile/ -- __init__.py -- your_own_fab_tasks.py
如果您使用的是django<;1.6,请在 fabfile/__init__.py:
# flake8: noqa from myproject import settings from django.core.management import setup_environ setup_environ(settings) from development_fabfile.fabfile import * from .your_own_fab_tasks import *
如果您的django>;=1.6,请在 fabfile/__init__.py:
import os os.environ.setdefault( "DJANGO_SETTINGS_MODULE", "myproject.settings") from development_fabfile.fabfile import * from .your_own_fab_tasks import *
在最下面的settings.py中添加以下内容:
from fabfile_settings import * # NOQA
然后在settings.py旁边创建一个fabfile_settings.py并添加 所有必要的设置。作为起点,您可以复制 fabfile_settings.py.sample并将所有值更改为 项目。
Python3
请注意,该结构与Python3不兼容。请使用fabric3 相反。