support for uploading files and serving them back via apache
[plstackapi.git] / planetstack / planetstack / settings.py
1 from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS as TCP
2
3 # Django settings for planetstack project.
4 from config import Config
5 config = Config()
6  
7 DEBUG = True
8 TEMPLATE_DEBUG = DEBUG
9
10 ADMINS = (
11     # ('Your Name', 'your_email@example.com'),
12 )
13
14 LOGIN_REDIRECT_URL = '/admin/core/user'
15
16 MANAGERS = ADMINS
17
18 DATABASES = {
19     'default': {
20         'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
21         'NAME': config.db_name,                      # Or path to database file if using sqlite3.
22         # The following settings are not used with sqlite3:
23         'USER': config.db_user,
24         'PASSWORD': config.db_password,
25         'HOST': config.db_host,                      # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
26         'PORT': '',                      # Set to empty string for default.
27     }
28 }
29
30 AUTH_USER_MODEL = 'core.User'
31
32
33 # Hosts/domain names that are valid for this site; required if DEBUG is False
34 # See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
35 ALLOWED_HOSTS = []
36
37 # Local time zone for this installation. Choices can be found here:
38 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
39 # although not all choices may be available on all operating systems.
40 # In a Windows environment this must be set to your system time zone.
41 TIME_ZONE = 'America/New_York'
42
43 # Language code for this installation. All choices can be found here:
44 # http://www.i18nguy.com/unicode/language-identifiers.html
45 LANGUAGE_CODE = 'en-us'
46
47 SITE_ID = 1
48
49 # If you set this to False, Django will make some optimizations so as not
50 # to load the internationalization machinery.
51 USE_I18N = True
52
53 # If you set this to False, Django will not format dates, numbers and
54 # calendars according to the current locale.
55 USE_L10N = True
56
57 # If you set this to False, Django will not use timezone-aware datetimes.
58 USE_TZ = True
59
60 # Absolute filesystem path to the directory that will hold user-uploaded files.
61 # Example: "/var/www/example.com/media/"
62 MEDIA_ROOT = '/var/www/html/files/'
63
64 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
65 # trailing slash.
66 # Examples: "http://example.com/media/", "http://media.example.com/"
67 MEDIA_URL = '/files/'
68
69 # Absolute path to the directory static files should be collected to.
70 # Don't put anything in this directory yourself; store your static files
71 # in apps' "static/" subdirectories and in STATICFILES_DIRS.
72 # Example: "/var/www/example.com/static/"
73 STATIC_ROOT = ''
74
75 # URL prefix for static files.
76 # Example: "http://example.com/static/", "http://static.example.com/"
77 STATIC_URL = '/static/'
78
79 # Additional locations of static files
80 STATICFILES_DIRS = ( "/opt/planetstack/core/static/",
81     # Put strings here, like "/home/html/static" or "C:/www/django/static".
82     # Always use forward slashes, even on Windows.
83     # Don't forget to use absolute paths, not relative paths.
84 )
85
86 # List of finder classes that know how to find static files in
87 # various locations.
88 STATICFILES_FINDERS = (
89     'django.contrib.staticfiles.finders.FileSystemFinder',
90     'django.contrib.staticfiles.finders.AppDirectoriesFinder',
91 #    'django.contrib.staticfiles.finders.DefaultStorageFinder',
92 )
93
94 # Make this unique, and don't share it with anybody.
95 SECRET_KEY = 'i0=a)c7_#2)5m%k_fu#%53xap$tlqc+#&z5as+bl7&)(@be_f9'
96
97 # List of callables that know how to import templates from various sources.
98 TEMPLATE_LOADERS = (
99     'django.template.loaders.filesystem.Loader',
100     'django.template.loaders.app_directories.Loader',
101 #     'django.template.loaders.eggs.Loader',
102 )
103
104 MIDDLEWARE_CLASSES = (
105     'django.middleware.common.CommonMiddleware',
106     'django.contrib.sessions.middleware.SessionMiddleware',
107     'django.middleware.csrf.CsrfViewMiddleware',
108     'django.contrib.auth.middleware.AuthenticationMiddleware',
109     'django.contrib.messages.middleware.MessageMiddleware',
110     # Uncomment the next line for simple clickjacking protection:
111     # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
112 )
113
114 ROOT_URLCONF = 'planetstack.urls'
115
116 # Python dotted path to the WSGI application used by Django's runserver.
117 WSGI_APPLICATION = 'planetstack.wsgi.application'
118
119 TEMPLATE_DIRS = (
120     # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
121     # Always use forward slashes, even on Windows.
122     # Don't forget to use absolute paths, not relative paths.
123     "/opt/planetstack/templates"
124 )
125
126 INSTALLED_APPS = (
127     'django.contrib.auth',
128     'django.contrib.contenttypes',
129     'django.contrib.sessions',
130 #    'django.contrib.sites',
131     'django.contrib.messages',
132     'django.contrib.staticfiles',
133     # Uncomment the next line to enable the admin:
134     'suit',
135     'django.contrib.admin',
136     # Uncomment the next line to enable admin documentation:
137     'django.contrib.admindocs',
138     'rest_framework',
139     'django_extensions',
140     'django_evolution',
141     'core',
142     'hpc',
143     'requestrouter',
144     'syndicate',
145     'geoposition',
146 )
147
148
149 # Added for django-suit form 
150 TEMPLATE_CONTEXT_PROCESSORS = TCP + (
151     'django.core.context_processors.request',
152 )
153
154 # Django Suit configuration example
155 SUIT_CONFIG = {
156     # header
157     'ADMIN_NAME': 'OpenCloud',
158     # 'HEADER_DATE_FORMAT': 'l, j. F Y',
159     # 'HEADER_TIME_FORMAT': 'H:i',
160
161     # forms
162     #'SHOW_REQUIRED_ASTERISK': True,  # Default True
163     'CONFIRM_UNSAVED_CHANGES': True, # Default True
164
165     # menu
166     # 'SEARCH_URL': '/admin/auth/user/',
167     # 'MENU_ICONS': {
168     #    'sites': 'icon-leaf',
169     #    'auth': 'icon-lock',
170     # },
171     # 'MENU_OPEN_FIRST_CHILD': True, # Default True
172     'MENU_EXCLUDE': (
173          'auth.group',
174          'auth', 
175          'core.network',
176          'core.sliver',
177          'core.node',
178          'core.image',
179          'core.deploymentrole',
180          'core.siterole',
181          'core.slicerole',
182          'core.planetstackrole',
183          'core.networktemplate',
184          'core.networkparametertype',
185          'core.router',
186          'core.tag',
187          'core.account',
188          'core.invoice',
189          'core.serviceclass',
190     ),
191     'MENU': (
192         #{'app': 'core', 'icon':'icon-lock'},
193         #{'app': 'core', 'icon': 'icon-lock', 'models': ('core.site', 'core.deployment', 'core.service', 'core.slice', 'core.user', 'core.reservation', 'core.account', 'core.invoice', 'core.payment', 'core.usableobject')},
194         {'label': 'Deployments', 'icon':'icon-deployment', 'url': '/admin/core/deployment/'},
195         {'label': 'Sites', 'icon':'icon-site', 'url': '/admin/core/site/'},
196         {'label': 'Slices', 'icon':'icon-slice', 'url': '/admin/core/slice/'},
197         {'label': 'Users', 'icon':'icon-user', 'url': '/admin/core/user/'},
198         {'label': 'Request Routing', 'icon':'icon-cog', 'app': 'requestrouter'},
199         {'label': 'HyperCache', 'icon':'icon-cog', 'app': 'hpc'},
200         {'label': 'Syndicate', 'icon':'icon-cog', 'app': 'syndicate'},
201         #{'label': 'Configured Services', 'icon':'icon-cog', 'models': [{'label': 'Content Delivery Network', 'app':'hpc'}]},
202     #     'sites',
203     #     {'app': 'auth', 'icon':'icon-lock', 'models': ('user', 'group')},
204     #     {'label': 'Support', 'icon':'icon-question-sign', 'url': '/support/'},
205     #   {'label': 'Settings', 'icon':'icon-cog', 'models': ('core.user', 'core.site')},
206     # ),
207     ),
208
209     # misc
210     # 'LIST_PER_PAGE': 15
211 }
212
213 # A sample logging configuration. The only tangible logging
214 # performed by this configuration is to send an email to
215 # the site admins on every HTTP 500 error when DEBUG=False.
216 # See http://docs.djangoproject.com/en/dev/topics/logging for
217 # more details on how to customize your logging configuration.
218 LOGGING = {
219     'version': 1,
220     'disable_existing_loggers': False,
221     'filters': {
222         'require_debug_false': {
223             '()': 'django.utils.log.RequireDebugFalse'
224         }
225     },
226     'handlers': {
227         'mail_admins': {
228             'level': 'ERROR',
229             'filters': ['require_debug_false'],
230             'class': 'django.utils.log.AdminEmailHandler'
231         }
232     },
233     'loggers': {
234         'django.request': {
235             'handlers': ['mail_admins'],
236             'level': 'ERROR',
237             'propagate': True,
238         },
239     }
240 }