mise en place settings avec version local
Parent
3033c547f1
révision
6603fc33c4
|
@ -1,5 +1,5 @@
|
|||
*~
|
||||
*.pyc
|
||||
settings.py
|
||||
settings_local*.py
|
||||
.env
|
||||
.ropeproject
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
*~
|
||||
*.pyc
|
||||
settings.py
|
||||
settings_local*.py
|
||||
.env
|
||||
.ropeproject
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import sys
|
||||
try:
|
||||
from settings_default import *
|
||||
except ImportError, e:
|
||||
print """
|
||||
-------------------------------------------------------------------------
|
||||
Note to developper: the settings is not properly configured.
|
||||
1. Move the original settings.py to settings_default.py
|
||||
2. Clean default_settings from all secret, password
|
||||
-> move any password to settings_local.py
|
||||
-------------------------------------------------------------------------
|
||||
"""
|
||||
sys.exit(1)
|
||||
|
||||
if not 'PROJECT_PATH' in globals():
|
||||
print """
|
||||
-------------------------------------------------------------------------
|
||||
Note to developper: the settings is not properly configured.
|
||||
1. Add the following code to settings/default_settings.py
|
||||
import os.path
|
||||
PROJECT_PATH = os.path.dirname(__file__) or '.'
|
||||
-------------------------------------------------------------------------
|
||||
"""
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
from settings_local import *
|
||||
except ImportError, e:
|
||||
print """
|
||||
-------------------------------------------------------------------------
|
||||
You need to create a settings_local.py file which needs to
|
||||
contain at least database connection information.
|
||||
|
||||
In settings, copy settings_local.py.sample to settings_local.py and edit it.
|
||||
-------------------------------------------------------------------------
|
||||
"""
|
||||
sys.exit(1)
|
||||
|
||||
# just use sqlite in-memory database for test
|
||||
# avoid the hassle to create and destroy a full postgres SQL database
|
||||
if 'test' in sys.argv:
|
||||
DATABASES['default'] = {'ENGINE': 'django.db.backends.sqlite3'}
|
||||
# End of file
|
|
@ -3,6 +3,8 @@
|
|||
import os
|
||||
from django.conf import global_settings
|
||||
|
||||
PROJECT_PATH = os.path.dirname(__file__) or '.'
|
||||
|
||||
DEBUG = True
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
|
||||
|
@ -12,13 +14,6 @@ ADMINS = (
|
|||
|
||||
MANAGERS = ADMINS
|
||||
|
||||
DATABASE_ENGINE = 'postgresql_psycopg2' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
|
||||
DATABASE_NAME = 'apes' # Or path to database file if using sqlite3.
|
||||
DATABASE_USER = 'apes' # Not used with sqlite3.
|
||||
DATABASE_PASSWORD = 'apes' # Not used with sqlite3.
|
||||
DATABASE_HOST = 'localhost' # Set to empty string for localhost. Not used with sqlite3.
|
||||
DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
|
||||
|
||||
# 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.
|
||||
|
@ -83,8 +78,8 @@ 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.
|
||||
os.path.dirname(__file__) + '/templates',
|
||||
os.path.dirname(__file__),
|
||||
PROJECT_PATH + '/templates',
|
||||
PROJECT_PATH,
|
||||
)
|
||||
|
||||
INSTALLED_APPS = (
|
||||
|
@ -103,14 +98,9 @@ INSTALLED_APPS = (
|
|||
)
|
||||
|
||||
# Applications media
|
||||
STATIC_MEDIA_ROOT = os.path.dirname(__file__) + '/static_media/'
|
||||
STATIC_MEDIA_ROOT = PROJECT_PATH + '/static_media/'
|
||||
STATIC_MEDIA_URL = '/static_media/'
|
||||
|
||||
# For a subdir:
|
||||
#subdir = '/bdd'
|
||||
#LOGIN_URL = subdir + '/accounts/login/'
|
||||
#LOGIN_REDIRECT_URL = subdir + '/'
|
||||
#REQUIRE_LOGIN_PATH = LOGIN_URL
|
||||
#STATIC_MEDIA_URL = subdir + '/static_media/'
|
||||
#MEDIA_URL = subdir + '/upload/'
|
||||
#ADMIN_MEDIA_PREFIX = subdir + '/media/'
|
||||
STATIC_URL = '/static'
|
||||
|
||||
# EOF
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
# -*- mode: python ; coding: utf-8 -*-
|
||||
# Django local settings for grapes project. (always_data)
|
||||
from settings_default import *
|
||||
|
||||
DEBUG = True
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
DJ_DEBUG_TOOLBAR = False
|
||||
DJ_COVERAGE = False
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||
# Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
|
||||
'NAME': 'grapes', # Or path to database file if using sqlite3.
|
||||
'USER': 'grapes', # Not used with sqlite3.
|
||||
'PASSWORD': 'grapes', # Not used with sqlite3.
|
||||
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
|
||||
'PORT': '', # Set to empty string for default. Not used with sqlite3.
|
||||
}
|
||||
}
|
||||
|
||||
# Make this unique, and don't share it with anybody.
|
||||
#SECRET_KEY = 'xuklg&i06jh1-hms4gbl)6!ewjta&r%**8(91kx^@wmd-t_l-h'
|
||||
|
||||
ADMINS = (
|
||||
# ('Your Name', 'your_email@domain.com'),
|
||||
)
|
||||
|
||||
## debug_toolbar config
|
||||
INTERNAL_IPS = ('127.0.0.1','192.168.101.51', '212.198.6.129')
|
||||
DEBUG_TOOLBAR_PANELS = (
|
||||
'debug_toolbar.panels.version.VersionDebugPanel',
|
||||
'debug_toolbar.panels.timer.TimerDebugPanel',
|
||||
'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel',
|
||||
'debug_toolbar.panels.headers.HeaderDebugPanel',
|
||||
'debug_toolbar.panels.request_vars.RequestVarsDebugPanel',
|
||||
'debug_toolbar.panels.template.TemplateDebugPanel',
|
||||
'debug_toolbar.panels.sql.SQLDebugPanel',
|
||||
'debug_toolbar.panels.signals.SignalDebugPanel',
|
||||
'debug_toolbar.panels.logger.LoggingPanel',
|
||||
)
|
||||
DEBUG_TOOLBAR_CONFIG = {
|
||||
'INTERCEPT_REDIRECTS' : False,
|
||||
}
|
||||
|
||||
if DJ_DEBUG_TOOLBAR:
|
||||
MIDDLEWARE_CLASSES = (
|
||||
'debug_toolbar.middleware.DebugToolbarMiddleware',
|
||||
) + MIDDLEWARE_CLASSES
|
||||
INSTALLED_APPS = INSTALLED_APPS + ('debug_toolbar',)
|
||||
|
||||
if DJ_COVERAGE:
|
||||
INSTALLED_APPS = INSTALLED_APPS + ('django_coverage',)
|
||||
TEST_RUNNER = 'django_coverage.coverage_runner.CoverageRunner'
|
||||
|
||||
#LOGIN_REDIRECT_URL = '/'
|
||||
#REQUIRE_LOGIN_PATH = '/accounts/login/'
|
||||
|
||||
# For a sublocation:
|
||||
SUBLOCATION = ''
|
||||
for item in (
|
||||
'LOGIN_URL',
|
||||
'LOGIN_REDIRECT_URL',
|
||||
'STATIC_MEDIA_URL',
|
||||
'STATIC_URL',
|
||||
'MEDIA_URL'):
|
||||
if item in globals():
|
||||
globals()[item] = SUBLOCATION + globals()[item]
|
||||
|
||||
#SESSION_COOKIE_PATH = SUBLOCATION
|
||||
#CSRF_COOKIE_PATH = SUBLOCATION
|
||||
|
||||
#24h = 86400 secondes
|
||||
SESSION_COOKIE_AGE=86400
|
||||
|
||||
SERVER_EMAIL='grapes@fqdn'
|
||||
EMAIL_HOST = '' # a SMTP server
|
||||
EMAIL_PORT = 25
|
||||
|
||||
# EOF
|
Chargement…
Référencer dans un nouveau ticket