mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	Rename local_settings.py symlink to prod_settings.py.
This commit is contained in:
		@@ -58,9 +58,9 @@ In a production environment, we have:
 | 
			
		||||
  middleware, etc.), as well as default values for the settings the
 | 
			
		||||
  user would set in `/etc/zulip/settings.py` (you can look at the
 | 
			
		||||
  `DEFAULT_SETTINGS` dictionary to easily review the settings
 | 
			
		||||
  available).  `zproject/settings.py` has a line `from local_settings
 | 
			
		||||
  available).  `zproject/settings.py` has a line `from prod_settings
 | 
			
		||||
  import *`, which has the effect of importing
 | 
			
		||||
  `/etc/zulip/settings.py`.
 | 
			
		||||
  `/etc/zulip/settings.py` in a prod environment (via a symlink).
 | 
			
		||||
 | 
			
		||||
In a development environment, we have `zproject/settings.py`, and
 | 
			
		||||
additionally:
 | 
			
		||||
 
 | 
			
		||||
@@ -71,7 +71,7 @@ fi
 | 
			
		||||
if [ "$has_appserver" = 0 ]; then
 | 
			
		||||
    /root/zulip/scripts/setup/generate_secrets.py
 | 
			
		||||
    cp -a /root/zulip/zproject/local_settings_template.py /etc/zulip/settings.py
 | 
			
		||||
    ln -nsf /etc/zulip/settings.py /root/zulip/zproject/local_settings.py
 | 
			
		||||
    ln -nsf /etc/zulip/settings.py /root/zulip/zproject/prod_settings.py
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Restart camo since generate_secrets.py likely replaced its secret key
 | 
			
		||||
@@ -104,7 +104,7 @@ if [ "$has_appserver" = 0 ]; then
 | 
			
		||||
    ln -nsf /home/zulip/deployments/next /root/zulip
 | 
			
		||||
    ln -nsf "$deploy_path" /home/zulip/deployments/next
 | 
			
		||||
    ln -nsf "$deploy_path" /home/zulip/deployments/current
 | 
			
		||||
    ln -nsf /etc/zulip/settings.py "$deploy_path"/zproject/local_settings.py
 | 
			
		||||
    ln -nsf /etc/zulip/settings.py "$deploy_path"/zproject/prod_settings.py
 | 
			
		||||
    mkdir -p "$deploy_path"/prod-static/serve
 | 
			
		||||
    cp -rT "$deploy_path"/prod-static/serve /home/zulip/prod-static
 | 
			
		||||
    chown -R zulip:zulip /home/zulip /var/log/zulip /etc/zulip/settings.py
 | 
			
		||||
 
 | 
			
		||||
@@ -25,7 +25,7 @@ subprocess.check_call(["tar", "-xf", tarball_path, "-C", extract_path])
 | 
			
		||||
subprocess.check_call(["mv", glob.glob(os.path.join(extract_path, "zulip-server-*"))[0], deploy_path])
 | 
			
		||||
subprocess.check_call(["rmdir", extract_path])
 | 
			
		||||
subprocess.check_call(["ln", "-nsf", "/etc/zulip/settings.py",
 | 
			
		||||
                       os.path.join(deploy_path, "zproject/local_settings.py")])
 | 
			
		||||
                       os.path.join(deploy_path, "zproject/prod_settings.py")])
 | 
			
		||||
subprocess.check_call(["ln", '-nsf', deploy_path, os.path.join(DEPLOYMENTS_DIR, "next")])
 | 
			
		||||
 | 
			
		||||
print(deploy_path)
 | 
			
		||||
 
 | 
			
		||||
@@ -44,6 +44,11 @@ try:
 | 
			
		||||
 | 
			
		||||
    os.chdir(deploy_path)
 | 
			
		||||
 | 
			
		||||
    if ZULIP_COM:
 | 
			
		||||
        # Install the zulip.com settings (local_settings.py) as prod_settings.py
 | 
			
		||||
        subprocess.check_call(["ln", "-nsf", os.path.join(deploy_path, "zproject/local_settings.py"),
 | 
			
		||||
                               os.path.join(deploy_path, "zproject/prod_settings.py")])
 | 
			
		||||
 | 
			
		||||
    subprocess.check_call(["sudo", os.path.join(deploy_path, "scripts", "lib", "create-production-venv"),
 | 
			
		||||
                           os.path.join(deploy_path, "zulip-venv")])
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -195,7 +195,7 @@ class Command(BaseCommand):
 | 
			
		||||
            if (not settings.EMAIL_GATEWAY_BOT or not settings.EMAIL_GATEWAY_LOGIN or
 | 
			
		||||
                not settings.EMAIL_GATEWAY_PASSWORD or not settings.EMAIL_GATEWAY_IMAP_SERVER or
 | 
			
		||||
                not settings.EMAIL_GATEWAY_IMAP_PORT or not settings.EMAIL_GATEWAY_IMAP_FOLDER):
 | 
			
		||||
                print("Please configure the Email Mirror Gateway in your local_settings.py, "
 | 
			
		||||
                print("Please configure the Email Mirror Gateway in /etc/zulip/, "
 | 
			
		||||
                      "or specify $ORIGINAL_RECIPIENT if piping a single mail.")
 | 
			
		||||
                exit(1)
 | 
			
		||||
            reactor.callLater(0, main)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
 | 
			
		||||
# For the Dev VM environment, we use the same settings as the
 | 
			
		||||
# sample local_settings.py file, with a few exceptions.
 | 
			
		||||
# sample prod_settings.py file, with a few exceptions.
 | 
			
		||||
from .local_settings_template import *
 | 
			
		||||
 | 
			
		||||
LOCAL_UPLOADS_DIR = 'var/uploads'
 | 
			
		||||
 
 | 
			
		||||
@@ -5,8 +5,8 @@ from __future__ import absolute_import
 | 
			
		||||
#
 | 
			
		||||
# * settings.py contains non-site-specific and settings configuration
 | 
			
		||||
# for the Zulip Django app.
 | 
			
		||||
# * settings.py imports local_settings.py, and any site-specific configuration
 | 
			
		||||
# belongs there.  The template for local_settings.py is local_settings_template.py
 | 
			
		||||
# * settings.py imports prod_settings.py, and any site-specific configuration
 | 
			
		||||
# belongs there.  The template for prod_settings.py is local_settings_template.py
 | 
			
		||||
#
 | 
			
		||||
# See http://zulip.readthedocs.io/en/latest/settings.html for more information
 | 
			
		||||
#
 | 
			
		||||
@@ -79,10 +79,10 @@ TEST_SUITE = False
 | 
			
		||||
# The new user tutorial is enabled by default, but disabled for client tests.
 | 
			
		||||
TUTORIAL_ENABLED = True
 | 
			
		||||
 | 
			
		||||
# Import variables like secrets from the local_settings file
 | 
			
		||||
# Import local_settings after determining the deployment/machine type
 | 
			
		||||
# Import variables like secrets from the prod_settings file
 | 
			
		||||
# Import prod_settings after determining the deployment/machine type
 | 
			
		||||
if PRODUCTION:
 | 
			
		||||
    from .local_settings import *
 | 
			
		||||
    from .prod_settings import *
 | 
			
		||||
else:
 | 
			
		||||
    from .dev_settings import *
 | 
			
		||||
 | 
			
		||||
@@ -90,7 +90,7 @@ else:
 | 
			
		||||
# DEFAULT VALUES FOR SETTINGS
 | 
			
		||||
########################################################################
 | 
			
		||||
 | 
			
		||||
# For any settings that are not defined in local_settings.py,
 | 
			
		||||
# For any settings that are not defined in prod_settings.py,
 | 
			
		||||
# we want to initialize them to sane default
 | 
			
		||||
DEFAULT_SETTINGS = {'TWITTER_CONSUMER_KEY': '',
 | 
			
		||||
                    'TWITTER_CONSUMER_SECRET': '',
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user