Self hosted FLOSS fitness/workout, nutrition and weight tracker
Split the database configuration file
Roland Geider46b74600899f
diff --git a/software/templates/code.html b/software/templates/code.htmlindex 0d1087b39..5b7d991a7 100644--- a/software/templates/code.html+++ b/software/templates/code.html@@ -91,8 +91,11 @@ $ cp settings.sample.py settings.py</code>-<p>{% blocktrans %}Edit settings.py, setting the type of database you want to use.-The fastest to set up is Sqlite, but you can use whatever Django supports.+<p>{% blocktrans %}Open settings.py and change the settings there as appropriate.+There is another configuration file, settings_global.py that contains other global+settings, but you don't need to change anything there. For the database, the+fastest to set up is Sqlite, but you can use+<a href="https://docs.djangoproject.com/en/1.4/ref/databases/">whatever Django supports</a>.Initialise the database and create a super user.{% endblocktrans %}</p><code>@@ -100,18 +103,6 @@ $ cd ..$ python manage.py syncdb</code>-<p>{% blocktrans %}This application uses reCaptcha to avoid registration-spam, for this you need to add your public and private keys to-settings.py.{% endblocktrans %}</p>--<code>-RECAPTCHA_PUBLIC_KEY = ''-RECAPTCHA_PRIVATE_KEY = ''-</code>--<p>{% blocktrans %}Also set the secret key used for user salt,-<code>SECRET_KEY</code>.{% endblocktrans %}</p>-<p>{% blocktrans %}Now you are ready to go, the application is installed andcan be used. However, an application like this without data is not interesting,so you should load some initial data to populate the categories,@@ -142,3 +133,4 @@ $ python manage.py runserver{% endblock %}+diff --git a/workout_manager/settings.sample.py b/workout_manager/settings.sample.pyindex 24e33c497..31a9600ea 100644--- a/workout_manager/settings.sample.py+++ b/workout_manager/settings.sample.py@@ -1,14 +1,36 @@-# Django settings for workout_manager project.-+# -*- coding: utf-8 -*-++# This file is part of Workout Manager.+#+# Workout Manager is free software: you can redistribute it and/or modify+# it under the terms of the GNU Affero General Public License as published by+# the Free Software Foundation, either version 3 of the License, or+# (at your option) any later version.+#+# Workout Manager is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU Affero General Public License+++'''+This file contains global settings that don't need to be changed by the user+'''++from workout_manager.settings_global import *++# Use 'DEBUG = True' to get more details for server errors+# (Default for releases: 'False')DEBUG = TrueTEMPLATE_DEBUG = DEBUG-ADMINS = (- ('Roland Geider', '[email protected]'),-)-MANAGERS = ADMINS+# Make this unique, and don't share it with anybody.+SECRET_KEY = ''+# Database settingsDATABASES = {'default': {'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.@@ -20,200 +42,10 @@ DATABASES = {}}-# Login-URL-LOGIN_URL = '/login/'--# Redirect here after sucessfull login-LOGIN_REDIRECT_URL = '/'--# Model for the user profile-AUTH_PROFILE_MODULE = 'manager.UserProfile'--# Set the context processors-TEMPLATE_CONTEXT_PROCESSORS = (- 'manager.context_processor.processor',- 'django.contrib.auth.context_processors.auth',- 'django_browserid.context_processors.browserid_form',-)---# Local time zone for this installation. Choices can be found here:-# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name-# although not all choices may be available on all operating systems.-# On Unix systems, a value of None will cause Django to use the same-# timezone as the operating system.-# If running in a Windows environment this must be set to the same as your-# system time zone.-TIME_ZONE = None--# Language code for this installation. All choices can be found here:-# http://www.i18nguy.com/unicode/language-identifiers.html-LANGUAGE_CODE = 'en-us'--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.-# Example: "/home/media/media.lawrence.com/media/"-MEDIA_ROOT = ''--# URL that handles the media served from MEDIA_ROOT. Make sure to use a-# trailing slash.-# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"-MEDIA_URL = ''--# Absolute path to the directory static files should be collected to.-# Don't put anything in this directory yourself; store your static files-# in apps' "static/" subdirectories and in STATICFILES_DIRS.-# Example: "/home/media/media.lawrence.com/static/"-STATIC_ROOT = ''--# URL prefix for static files.-# Example: "http://media.lawrence.com/static/"-STATIC_URL = '/static/'--# Additional locations of static files-STATICFILES_DIRS = (- # Put strings here, like "/home/html/static" or "C:/www/django/static".- # Always use forward slashes, even on Windows.- # Don't forget to use absolute paths, not relative paths.-)--# List of finder classes that know how to find static files in-# various locations.-STATICFILES_FINDERS = (- 'django.contrib.staticfiles.finders.FileSystemFinder',- 'django.contrib.staticfiles.finders.AppDirectoriesFinder',-# 'django.contrib.staticfiles.finders.DefaultStorageFinder',-)--# Make this unique, and don't share it with anybody.-SECRET_KEY = ''--# List of callables that know how to import templates from various sources.-TEMPLATE_LOADERS = (- 'django.template.loaders.filesystem.Loader',- 'django.template.loaders.app_directories.Loader',-# 'django.template.loaders.eggs.Loader',-)--MIDDLEWARE_CLASSES = (- 'django.middleware.common.CommonMiddleware',- 'django.contrib.sessions.middleware.SessionMiddleware',- 'django.middleware.csrf.CsrfViewMiddleware',- 'django.contrib.auth.middleware.AuthenticationMiddleware',- 'django.contrib.messages.middleware.MessageMiddleware',- # Uncomment the next line for simple clickjacking protection:- # 'django.middleware.clickjacking.XFrameOptionsMiddleware',- 'django.middleware.locale.LocaleMiddleware'-)--ROOT_URLCONF = 'workout_manager.urls'--# Python dotted path to the WSGI application used by Django's runserver.-WSGI_APPLICATION = 'workout_manager.wsgi.application'--TEMPLATE_DIRS = (- # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".- # Always use forward slashes, even on Windows.- # Don't forget to use absolute paths, not relative paths.- #'',-)--INSTALLED_APPS = (- 'django.contrib.auth',- 'django_browserid', # Load after auth to monkey-patch it.- 'django.contrib.contenttypes',- 'django.contrib.sessions',- 'django.contrib.sites',- 'django.contrib.messages',- 'django.contrib.staticfiles',- # Uncomment the next line to enable the admin:- 'django.contrib.admin',- # Uncomment the next line to enable admin documentation:- # 'django.contrib.admindocs',- 'manager',- 'weight',- 'exercises',- 'nutrition',- 'software',-- # reCaptcha support, see https://github.com/praekelt/django-recaptcha- 'captcha',-)-+# Your reCaptcha keysRECAPTCHA_PUBLIC_KEY = ''RECAPTCHA_PRIVATE_KEY = ''-AUTHENTICATION_BACKENDS = (- 'django.contrib.auth.backends.ModelBackend',- 'django_browserid.auth.BrowserIDBackend',-)--# This is needed for Mozilla's BrowserID-SITE_URL = 'http://mysite'--# A sample logging configuration. The only tangible logging-# performed by this configuration is to send an email to-# the site admins on every HTTP 500 error when DEBUG=False.-# See http://docs.djangoproject.com/en/dev/topics/logging for-# more details on how to customize your logging configuration.-LOGGING = {- 'version': 1,- 'disable_existing_loggers': False,- 'formatters': {- 'verbose': {- 'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'- },- 'simple': {- 'format': '%(levelname)s %(asctime)s %(module)s %(message)s'- },- },- 'filters': {- 'require_debug_false': {- '()': 'django.utils.log.RequireDebugFalse'- }- },- 'handlers': {- 'null': {- 'level':'DEBUG',- 'class':'django.utils.log.NullHandler',- },- 'mail_admins': {- 'level': 'ERROR',- 'filters': ['require_debug_false'],- 'class': 'django.utils.log.AdminEmailHandler'- },- 'console':{- 'level':'DEBUG',- 'class':'logging.StreamHandler',- 'formatter': 'simple'- },- },- 'loggers': {- 'django': {- 'handlers':['null'],- 'propagate': True,- 'level':'INFO',- },- 'django.request': {- 'handlers': ['mail_admins'],- 'level': 'ERROR',- 'propagate': True,- },- 'workout_manager.custom': {- 'handlers': ['console', 'mail_admins'],- 'level': 'DEBUG',- }- }-}+# The site's URL (e.g. http://www.my-gym-site.com or http://localhost:8000)+# This is needed for Mozilla's BrowserID to work+SITE_URL = 'http://localhost:8000'diff --git a/workout_manager/settings_global.py b/workout_manager/settings_global.pynew file mode 100644index 000000000..a635f9159--- /dev/null+++ b/workout_manager/settings_global.py@@ -0,0 +1,214 @@+# Django settings for workout_manager project.++ADMINS = (+ #('Roland Geider', '[email protected]'),+)++MANAGERS = ADMINS++# Restrict the available languages+ugettext = lambda s: s+LANGUAGES = (+ ('en', ugettext('English')),+ ('de', ugettext('German')),+)++# Default language code for this installation. All choices can be found here:+# http://www.i18nguy.com/unicode/language-identifiers.html+LANGUAGE_CODE = 'en'++# Login-URL+LOGIN_URL = '/login/'++# Redirect here after sucessfull login+LOGIN_REDIRECT_URL = '/'++# Model for the user profile+AUTH_PROFILE_MODULE = 'manager.UserProfile'++# Set the context processors+TEMPLATE_CONTEXT_PROCESSORS = (+ 'manager.context_processor.processor',+ 'django.contrib.auth.context_processors.auth',+ 'django_browserid.context_processors.browserid_form',+)+++# Local time zone for this installation. Choices can be found here:+# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name+# although not all choices may be available on all operating systems.+# On Unix systems, a value of None will cause Django to use the same+# timezone as the operating system.+# If running in a Windows environment this must be set to the same as your+# system time zone.+TIME_ZONE = None+++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.+# Example: "/home/media/media.lawrence.com/media/"+MEDIA_ROOT = ''++# URL that handles the media served from MEDIA_ROOT. Make sure to use a+# trailing slash.+# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"+MEDIA_URL = ''++# Absolute path to the directory static files should be collected to.+# Don't put anything in this directory yourself; store your static files+# in apps' "static/" subdirectories and in STATICFILES_DIRS.+# Example: "/home/media/media.lawrence.com/static/"+STATIC_ROOT = ''++# URL prefix for static files.+# Example: "http://media.lawrence.com/static/"+STATIC_URL = '/static/'++# Additional locations of static files+STATICFILES_DIRS = (+ # Put strings here, like "/home/html/static" or "C:/www/django/static".+ # Always use forward slashes, even on Windows.+ # Don't forget to use absolute paths, not relative paths.+)++# List of finder classes that know how to find static files in+# various locations.+STATICFILES_FINDERS = (+ 'django.contrib.staticfiles.finders.FileSystemFinder',+ 'django.contrib.staticfiles.finders.AppDirectoriesFinder',+# 'django.contrib.staticfiles.finders.DefaultStorageFinder',+)++# List of callables that know how to import templates from various sources.+TEMPLATE_LOADERS = (+ 'django.template.loaders.filesystem.Loader',+ 'django.template.loaders.app_directories.Loader',+# 'django.template.loaders.eggs.Loader',+)++MIDDLEWARE_CLASSES = (+ 'django.middleware.common.CommonMiddleware',+ 'django.contrib.sessions.middleware.SessionMiddleware',+ 'django.middleware.csrf.CsrfViewMiddleware',+ 'django.contrib.auth.middleware.AuthenticationMiddleware',+ 'django.contrib.messages.middleware.MessageMiddleware',+ # Uncomment the next line for simple clickjacking protection:+ # 'django.middleware.clickjacking.XFrameOptionsMiddleware',+ 'django.middleware.locale.LocaleMiddleware',+ 'debug_toolbar.middleware.DebugToolbarMiddleware',+)++INTERNAL_IPS = ('127.0.0.1',)++ROOT_URLCONF = 'workout_manager.urls'++# Python dotted path to the WSGI application used by Django's runserver.+WSGI_APPLICATION = 'workout_manager.wsgi.application'++TEMPLATE_DIRS = (+ # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".+ # Always use forward slashes, even on Windows.+ # Don't forget to use absolute paths, not relative paths.+ #'',+)++INSTALLED_APPS = (+ 'django.contrib.auth',+ 'django_browserid', # Load after auth to monkey-patch it.+ 'django.contrib.contenttypes',+ 'django.contrib.sessions',+ 'django.contrib.sites',+ 'django.contrib.messages',+ 'django.contrib.staticfiles',+ # Uncomment the next line to enable the admin:+ 'django.contrib.admin',+ # Uncomment the next line to enable admin documentation:+ # 'django.contrib.admindocs',+ 'manager',+ 'weight',+ 'exercises',+ 'nutrition',+ 'software',++ # reCaptcha support, see https://github.com/praekelt/django-recaptcha+ 'captcha',++ # Django debug toolbar+ 'debug_toolbar',+)+++INTERNAL_IPS = ('127.0.0.1',)++AUTHENTICATION_BACKENDS = (+ 'django.contrib.auth.backends.ModelBackend',+ 'django_browserid.auth.BrowserIDBackend',+)+++# A sample logging configuration. The only tangible logging+# performed by this configuration is to send an email to+# the site admins on every HTTP 500 error when DEBUG=False.+# See http://docs.djangoproject.com/en/dev/topics/logging for+# more details on how to customize your logging configuration.+LOGGING = {+ 'version': 1,+ 'disable_existing_loggers': False,+ 'formatters': {+ 'verbose': {+ 'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'+ },+ 'simple': {+ 'format': '%(levelname)s %(asctime)s %(module)s %(message)s'+ },+ },+ 'filters': {+ 'require_debug_false': {+ '()': 'django.utils.log.RequireDebugFalse'+ }+ },+ 'handlers': {+ 'null': {+ 'level':'DEBUG',+ 'class':'django.utils.log.NullHandler',+ },+ 'mail_admins': {+ 'level': 'ERROR',+ 'filters': ['require_debug_false'],+ 'class': 'django.utils.log.AdminEmailHandler'+ },+ 'console':{+ 'level':'DEBUG',+ 'class':'logging.StreamHandler',+ 'formatter': 'simple'+ },+ },+ 'loggers': {+ 'django': {+ 'handlers':['null'],+ 'propagate': True,+ 'level':'INFO',+ },+ 'django.request': {+ 'handlers': ['mail_admins'],+ 'level': 'ERROR',+ 'propagate': True,+ },+ 'workout_manager.custom': {+ 'handlers': ['console', 'mail_admins'],+ 'level': 'DEBUG',+ }+ }+}