PyLucid CMS Logo

a complete local_settings.py example

page message
  • Entry for this url doesn't exist.
  • Entry for this url doesn't exist.
  • Entry for this url doesn't exist.
  • Entry for this url doesn't exist.

Here a example local_settings.py

At least you should change:

If you use our create a new page instance script, some values are prefilled for you in the created instance.

↑ local_settings.py example  #

The newest version is allways here: https://github.com/jedie/PyLucid/blob/master/scripts/local_settings_example.py

Python
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# coding:utf-8

import os, tempfile

#
# Here a example local_settings.py
#
# At least you must specify MEDIA_ROOT and DATABASES.
#
# see also:
# http://www.pylucid.org/permalink/332/a-complete-local_settingspy-example
#


# Absolute _local_filesystem_path_ to the directory that holds media.
MEDIA_ROOT = "/var/www/YourSite/media/"


# URL that handles the media served from MEDIA_ROOT.
#     Example-1: "/media/" (default)
#     Examlpe-2: "http://other_domain.net/media/"
#     Example-3: "http://media.your_domain.net/"
MEDIA_URL = "/media/"


# URL prefix for django admin media -- CSS, JavaScript and images. Saved in /django/contrib/admin/media/
ADMIN_MEDIA_PREFIX = "/media/django/"


# Changeable if needed (But should be off in productive usage!):
DEBUG = False
SQL_DEBUG = False
TEMPLATE_DEBUG = False


# Database connection info.
# http://docs.djangoproject.com/en/dev/intro/tutorial01/#database-setup
# http://docs.djangoproject.com/en/dev/ref/settings/#setting-DATABASES
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': 'test.db3' # You should set a absolute path to the SQlite file!
    }
}


SITE_ID = 1
LANGUAGE_CODE = "en"

# A secret key for this particular Django installation.
# Used to provide a seed in secret-key hashing algorithms.
# Set this to a random string -- the longer, the better.
SECRET_KEY = "add-a-secret-key"


# Set the Django cache system.
# The LocMemCache isn't memory-efficient. Should be changed!
# see: http://docs.djangoproject.com/en/dev/topics/cache/#setting-up-the-cache
#
# You can test if cache works, with:
#     PyLucid admin menu / system / base check
#
_CACHE_PATH_PREFIX = "PyLucid"
# Change it with e.g. your username to make this cache "unique" on the server.
# This can be usefull on shared webhosting.
#
_CACHE_PATH_SUFFIX = str(SITE_ID)
# Must not changed.
#
_CACHE_PATH_MODE = 0700
# Default mode for cache directory is 0700 -> Useable only for current user.
# Change to 0777 if web process runs e.g. with nobody!
#
def _get_and_create_tempdir_location(entry):
    """Little helper for easy setup a cache filesystem path in temp"""
    path = os.path.join(tempfile.gettempdir(), "%s_%s_%s" % (_CACHE_PATH_PREFIX, entry, _CACHE_PATH_SUFFIX))
    if not os.path.exists(path):
        os.makedirs(path, _CACHE_PATH_MODE)
    else:
        os.chmod(path, _CACHE_PATH_MODE)
    return path

CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
        'LOCATION': _get_and_create_tempdir_location("default_cache"),
    },
    'dbtemplates': { # http://django-dbtemplates.readthedocs.org/en/latest/advanced/#caching
        'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
        'LOCATION': _get_and_create_tempdir_location("dbtemplates_cache"),
    },
    'local_sync_cache': {
        'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
        'LOCATION': _get_and_create_tempdir_location("local_sync_cache"),
    }
}


# Please change email-/SMTP-Settings:

# http://docs.djangoproject.com/en/dev/ref/settings/#email-backend
EMAIL_HOST = "localhost"
EMAIL_HOST_USER = "root@%s" % EMAIL_HOST
EMAIL_HOST_PASSWORD = ""

# http://docs.djangoproject.com/en/dev/ref/settings/#default-from-email
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER

# http://docs.djangoproject.com/en/dev/ref/settings/#server-email
SERVER_EMAIL = DEFAULT_FROM_EMAIL

# Please uncomment and insert your mail and email address:
#MANAGERS = (('John', 'john@example.com'), ('Mary', 'mary@example.com'))
#ADMINS = MANAGERS

↑ Database connection settings  #

see also:

minimal MySQL example:

Python
1
2
3
4
5
6
7
8
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'Database Name',
        'USER': 'Username',
        'PASSWORD': 'User Password',
    }
}
0 comments for 'local_settings.py':
    there exist no comment for 'local_settings.py'
Leave a comment

django-processinfo: 5.0 ms of 246.7 ms (2.0%)