diff options
author | Milo Casagrande <milo@ubuntu.com> | 2014-01-17 13:40:27 +0100 |
---|---|---|
committer | Milosz Wasilewski <milosz.wasilewski@linaro.org> | 2014-01-17 16:17:43 +0000 |
commit | 81de36a0d560858f778d310d528ab65f6966a66a (patch) | |
tree | 35232fae52001112506b7a9d9cda5b85337c9970 /linaroroadmap | |
parent | e6366c1d9c4cca286ad144dace0ebb1258bbf7c3 (diff) |
Reworked settings.py file, added missing prod files.
* Cleaned up the settings.py file, removed the secret key.
* Added template for local_settings.py file.
* Updated gitignore file.
* Added WSGI file and scripts for cron job.
Change-Id: I0f48da4f7569929197db9005544491ead59c9c5b
Reviewed-on: https://review.linaro.org/952
Reviewed-by: Milosz Wasilewski <milosz.wasilewski@linaro.org>
Diffstat (limited to 'linaroroadmap')
-rw-r--r-- | linaroroadmap/local_settings.py.dev | 30 | ||||
-rw-r--r-- | linaroroadmap/settings.py | 66 |
2 files changed, 73 insertions, 23 deletions
diff --git a/linaroroadmap/local_settings.py.dev b/linaroroadmap/local_settings.py.dev new file mode 100644 index 0000000..57c3d0c --- /dev/null +++ b/linaroroadmap/local_settings.py.dev @@ -0,0 +1,30 @@ +import random +import string + +CROWD = { + 'url': '', + 'app_name': '', + 'password': '', + 'superuser': False, +} + +JIRA_SERVER = '' +JIRA_USERNAME = '' +JIRA_PASSWORD = '' + +JIRA_PROJECT = '' +JIRA_STATUSES = [] +SFID = None + +AUTHENTICATION_BACKENDS = ( + 'crowd.backends.CrowdBackend', +) + +char_selection = string.ascii_letters = string.digits +char_selection += '!@#$%^&*(-_=+)' +secret_key = ''.join(random.sample(char_selection, 50)) + +SECRET_KEY = '{0}'.format(secret_key) + +STATIC_ROOT = '/var/www/roadmap.linaro.org/static/' +DEBUG = False diff --git a/linaroroadmap/settings.py b/linaroroadmap/settings.py index d18dd88..501d1d5 100644 --- a/linaroroadmap/settings.py +++ b/linaroroadmap/settings.py @@ -3,7 +3,7 @@ DEBUG = True ADMINS = ( - # ('Your Name', 'your_email@example.com'), + ('linaro-infrastructure', 'linaro-infrastructure-errors@linaro.org') ) AUTH_CROWD_ALWAYS_UPDATE_USER = True @@ -19,29 +19,44 @@ AUTH_CROWD_SERVER_TRUSTED_ROOT_CERTS_FILE = None TRUSTED_ADDRESS = [] -JIRA_PROJECT = "" +CROWD = { + 'url': '', + 'app_name': '', + 'password': '', + 'superuser': False, +} + +# The URL of the Jira server to connect to. +JIRA_SERVER = '' +# The user name to use to connect to JIRA_SERVER. +JIRA_USERNAME = '' +# The password for JIRA_SERVER. +JIRA_PASSWORD = '' + +JIRA_PROJECT = '' JIRA_STATUSES = [] -SFID = None # custom field that defines relation between blueprint and engineering card in greenhopper +# Custom field that defines relation between blueprint and engineering card +# in greenhopper +SFID = None AUTHENTICATION_BACKENDS = ( #'django.contrib.auth.backends.ModelBackend', 'crowdrest.backend.CrowdRestBackend', ) -MANAGERS = ADMINS - DATABASES = { 'default': { - 'ENGINE': '', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. - 'NAME': '', # Or path to database file if using sqlite3. - # The following settings are not used with sqlite3: + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': '/srv/production_roadmap/linaroroadmap.db', 'USER': '', 'PASSWORD': '', - 'HOST': '', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP. - 'PORT': '', # Set to empty string for default. + 'HOST': '', + 'PORT': '', } } +MANAGERS = ADMINS + # Hosts/domain names that are valid for this site; required if DEBUG is False # See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts ALLOWED_HOSTS = ['*'] @@ -50,29 +65,20 @@ ALLOWED_HOSTS = ['*'] # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # although not all choices may be available on all operating systems. # In a Windows environment this must be set to your system time zone. -TIME_ZONE = 'America/Chicago' +TIME_ZONE = 'Europe/London' # Language code for this installation. All choices can be found here: # http://www.i18nguy.com/unicode/language-identifiers.html LANGUAGE_CODE = 'en-us' -#USE_I18N = True -#ugettext = lambda s: s #LANGUAGES = ( # ('en-us', u'English'), #) SITE_ID = 1 -# If you set this to False, Django will make some optimizations so as not -# to load the internationalization machinery. USE_I18N = True - -# If you set this to False, Django will not format dates, numbers and -# calendars according to the current locale. USE_L10N = True - -# If you set this to False, Django will not use timezone-aware datetimes. USE_TZ = True # Absolute filesystem path to the directory that will hold user-uploaded files. @@ -110,7 +116,7 @@ STATICFILES_FINDERS = ( ) # Make this unique, and don't share it with anybody. -SECRET_KEY = 'd0jdu-gqrsj*8n@v!%x+s+!t-77y^$pz*s=ewebv0%c06wnyz-' +SECRET_KEY = '' # List of callables that know how to import templates from various sources. TEMPLATE_LOADERS = ( @@ -201,7 +207,21 @@ LOGGING = { try: from local_settings import * -except: - print "local_settings not found" +except ImportError: + import random + import string + + # Create local_settings with random SECRET_KEY. + char_selection = string.ascii_letters + string.digits + char_selection_with_punctuation = char_selection + '!@#$%^&*(-_=+)' + + # SECRET_KEY contains anything but whitespace + secret_key = ''.join(random.sample(char_selection_with_punctuation, 50)) + local_settings_content = "SECRET_KEY = '{0}'\n".format(secret_key) + + with open(os.path.join(PROJECT_ROOT, "local_settings.py"), "w") as f: + f.write(local_settings_content) + + from local_settings import * TEMPLATE_DEBUG = DEBUG |