How to re-use a reusable app in Django

前端 未结 2 1181
深忆病人
深忆病人 2021-02-04 02:38

I am trying to create my first site in Django and as I\'m looking for example apps out there to draw inspiration from, I constantly stumble upon a term called \"reusab

2条回答
  •  不知归路
    2021-02-04 03:09

    An old question, but here's what I do:

    If you're using a version control system (VCS), I suggest putting all of the reusable apps and libraries (including django) that your software needs in the VCS. If you don't want to put them directly under your project root, you can modify settings.py to add their location to sys.path.

    After that deployment is as simple as cloning or checking out the VCS repository to wherever you want to use it.

    This has two added benefits:

    • Version mismatches; your software always uses the version that you tested it with, and not the version that was available at the time of deployment.
    • If multiple people work on the project, nobody else has to deal with installing the dependencies.

    When it's time to update a component's version, update it in your VCS and then propagate the update to your deployments via it.

提交回复
热议问题