Mercurial: keep 2 branches in sync but with certain persistent differences?

前端 未结 5 1747
Happy的楠姐
Happy的楠姐 2021-02-02 01:25

I\'m a web developer working on my own using django, and I\'m trying to get my head round how best to deploy sites using mercurial. What I\'d like to have is to be able to keep

5条回答
  •  逝去的感伤
    2021-02-02 01:59

    I've solved this with local settings.

    1. Append to settings.py:

      try:
      from local_settings import *
      except ImportError:
      pass
      

    2. touch local_settings.py

    3. Add ^local_settings.py$ to your .hgignore

    Each deploy I do has it's own local settings (typically different DB stuff and different origin email addresses).

    PS: Only read the "minified versions of javascript portion" later. For this, I would suggest a post-update hook and a config setting (like JS_EXTENSION).

    Example (from the top of my head! not tested, adapt as necessary):

    1. Put JS_EXTENSION = '.raw.js' in your settings.py file;
    2. Put JS_EXTENSION = '.mini.js' in your local_settings.py file on the production server;
    3. Change JS inclusion from:
      To:
    4. Make a post-update hook that looks for *.raw.js and generates .mini.js (minified versions of raw);
    5. Add .mini.js$ to your .hgignore

提交回复
热议问题