source: main/trunk/openPLM/settings.py @ 1603

Revision 1603, 7.6 KB checked in by pcosquer, 9 years ago (diff)

settings.py: updates CELERY_ROUTES if document3D is enabled

Line 
1#-!- coding:utf-8 -!-
2# Django settings for openPLM project.
3# settings that you may have to modify are marked with a #XYZ: comment
4
5
6import sys
7import os.path
8
9#XYZ: once your installation is ok, you should change this to False
10DEBUG = True
11TEMPLATE_DEBUG = DEBUG
12
13ADMINS = (
14    #XYZ: some error are notified to this address
15    ('Your Name', 'your_email@domain.com'),
16)
17
18MANAGERS = ADMINS
19
20DATABASES = {
21    'default': {
22        'ENGINE': 'django.db.backends.postgresql_psycopg2', # or 'postgresql', 'mysql', 'sqlite3', 'oracle'.
23        'NAME': 'openplm',               # Or path to database file if using sqlite3.
24        'USER': 'django',                # Not used with sqlite3.
25        #XYZ: should be the password set by the postgresql command
26        # "create role django with password 'MyPassword' login;"
27        'PASSWORD': 'MyPassword',        # Not used with sqlite3.
28        'HOST': 'localhost',             # Set to empty string for localhost. Not used with sqlite3.
29        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
30    }
31}
32
33
34#XYZ: Local time zone for this installation. Choices can be found here:
35# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
36# although not all choices may be available on all operating systems.
37# If running in a Windows environment this must be set to the same as your
38# system time zone.
39TIME_ZONE = 'Europe/Paris'
40
41# Language code for this installation. All choices can be found here:
42# http://www.i18nguy.com/unicode/language-identifiers.html
43LANGUAGE_CODE = 'en-en'
44
45SITE_ID = 1
46
47# If you set this to False, Django will make some optimizations so as not
48# to load the internationalization machinery.
49USE_I18N = True
50
51# Absolute path to the directory that holds media.
52# Example: "/home/media/media.lawrence.com/"
53MEDIA_ROOT = '/var/django/openPLM/trunk/openPLM/media/'
54
55# URL that handles the media served from MEDIA_ROOT. Make sure to use a
56# trailing slash if there is a path component (optional in other cases).
57# Examples: "http://media.lawrence.com", "http://example.com/media/"
58MEDIA_URL = '/media/'
59
60# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
61# trailing slash.
62# Examples: "http://foo.com/media/", "/media/".
63ADMIN_MEDIA_PREFIX = '/media/admin/'
64
65# Make this unique, and don't share it with anybody.
66# XYZ: the script change_secret_key.py can do this for you
67SECRET_KEY = '0ham7d#fh669-xi@wxf1wcpbhn6tbbegtv_cml()_wcboyw&u&'
68
69# List of callables that know how to import templates from various sources.
70TEMPLATE_LOADERS = (
71    'django.template.loaders.filesystem.load_template_source',
72    'django.template.loaders.app_directories.load_template_source',
73#     'django.template.loaders.eggs.load_template_source',
74)
75
76MIDDLEWARE_CLASSES = (
77    'django.middleware.common.CommonMiddleware',
78    'django.contrib.csrf.middleware.CsrfMiddleware',
79    'django.contrib.sessions.middleware.SessionMiddleware',
80    'django.contrib.auth.middleware.AuthenticationMiddleware',
81    'openPLM.plmapp.middleware.locale.ProfileLocaleMiddleware',
82)
83
84ugettext = lambda s: s
85LANGUAGES = (
86      ('fr', u'Français'),
87      ('en', 'English'),
88      ('es', u'Español'),
89      ('ja', u'日本語'),
90      ('ru', u'Русский'),
91      ('zh_CN', u'中文'),
92)
93
94ROOT_URLCONF = 'openPLM.urls'
95
96TEMPLATE_DIRS = (
97    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
98    # Always use forward slashes, even on Windows.
99    # Don't forget to use absolute paths, not relative paths.
100    "/var/django/openPLM/trunk/openPLM/templates",
101)
102
103#: list of installed apps
104INSTALLED_APPS = (
105    'django.contrib.auth',
106    'django.contrib.contenttypes',
107    'django.contrib.sessions',
108    'django.contrib.sites',
109    'django.contrib.admin',
110    'django.contrib.comments',
111    'django.contrib.humanize',
112    'djcelery',
113    'haystack',
114    'south',
115    'openPLM.plmapp',
116    'openPLM.apps.rss',
117    'openPLM.apps.pdfgen', # enable pdf generations
118    #XYZ: you can add your application after this line
119    'openPLM.apps.cad',
120    'openPLM.apps.computer',
121    'openPLM.apps.cae',
122    'openPLM.apps.office',
123    # document3D requires pythonOCC, uncomment this line to enable it
124    # 'openPLM.apps.document3D',
125)
126
127AUTH_PROFILE_MODULE = 'plmapp.UserProfile'
128
129CELERY_CREATE_MISSING_QUEUES = True
130CELERY_ROUTES = {
131    "openPLM.plmapp.tasks.update_index": {"queue": "index"},
132    "openPLM.plmapp.tasks.update_indexes": {"queue": "index"},
133    "openPLM.plmapp.tasks.remove_index": {"queue": "index"},
134    "openPLM.plmapp.mail.do_send_histories_mail" : {"queue" : "mails"},
135    "openPLM.plmapp.mail.do_send_mail" : {"queue" : "mails"},
136}
137if "openPLM.apps.document3D" in INSTALLED_APPS:
138    CELERY_ROUTES.update({
139        "openPLM.apps.document3d.models.handle_step_file": {"queue": "step"},
140        "openPLM.apps.document3d.models.decomposer_all": {"queue": "step"},
141    })
142
143#XYZ: EMAIL settings
144# https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-EMAIL_HOST
145EMAIL_HOST = 'localhost'
146EMAIL_PORT = 1025
147
148#: directory that stores documents. Make sure to use a trailing slash.
149DOCUMENTS_DIR = "/var/openPLM/docs/"
150THUMBNAILS_DIR = os.path.join(MEDIA_ROOT, "thumbnails/")
151#: directory that stores thumbnails. Make sure to use a trailing slash.
152THUMBNAILS_URL = MEDIA_URL + "thumbnails/"
153
154# Cookie used for session is temporary and is deleted when browser is closed
155SESSION_EXPIRE_AT_BROWSER_CLOSE = True
156MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'
157
158# Add user, messages and perms variables in RequestContext
159TEMPLATE_CONTEXT_PROCESSORS = (
160        "django.contrib.auth.context_processors.auth",
161        "django.core.context_processors.debug",
162        "django.core.context_processors.i18n",
163        "django.core.context_processors.media",
164        "django.core.context_processors.request",
165        "django.contrib.messages.context_processors.messages",
166        )
167
168
169#XYZ:
170#: expeditor's mail used when sending notification emails
171EMAIL_OPENPLM = "no-reply@openplm.example.com"
172
173#XYZ:
174#: Subject of a sponsor mail.
175#: It can be a valid django template string, two variables are available:
176#: ``new_user`` and ``sponsor`` (:class:`.User` instances)
177#: for example, it could be
178#: ``u"Welcome {{new_user.get_full_name}}, {{sponsor.get_full_name}} has sponsored you on OpenPLM"``.
179NEW_ACCOUNT_SUBJECT = u"New account on OpenPLM"
180
181#: Max file size for documents in bytes, -1 means illimited
182MAX_FILE_SIZE = -1
183
184# search stuff
185if "rebuild_index" not in sys.argv:
186    HAYSTACK_ENABLE_REGISTRATIONS = False
187HAYSTACK_SITECONF = 'openPLM.plmapp.search_sites'
188HAYSTACK_SEARCH_ENGINE = 'xapian'
189HAYSTACK_XAPIAN_PATH = "/var/openPLM/xapian_index/"
190HAYSTACK_INCLUDE_SPELLING = True
191EXTRACTOR = os.path.abspath(os.path.join(os.path.dirname(__file__), "bin", "extractor.sh"))
192
193# celery stuff
194import djcelery
195djcelery.setup_loader()
196
197BROKER_HOST = "localhost"
198BROKER_PORT = 5672
199BROKER_USER = "openplm"
200
201#XYZ: you will have to change this password
202# it must be the same as the one set by the command ``rabbitmqctl add_user openplm 'secret'``
203BROKER_PASSWORD = "secret"
204BROKER_VHOST = "openplm"
205
206#Gestion native
207ENABLE_NATIVE_FILE_MANAGEMENT=True
208
209
210# change these settings to True to force https connection
211#: set to True so that browsers ensure the cookie is only sent under an HTTPS connection
212SESSION_COOKIE_SECURE = False
213#: Force HTTPS connections
214FORCE_HTTPS = False
215
216#: set to True to hide emails
217HIDE_EMAILS = False
218
219#: Never delete files. If a user deletes a file, the file is deprecated instead of being deleted.
220#: Warning, if set to True, OpenPLM may consume a lot of disk place.
221KEEP_ALL_FILES = False
222
223COMPANY = "company"
224
225# change this setting if you use an other user documentation for OpenPLM
226DOCUMENTATION_URL = "http://wiki.openplm.org/docs/user/"
Note: See TracBrowser for help on using the repository browser.