CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-creme-crm

A comprehensive Customer Relationship Management software built on Django with extensive customization capabilities

Overview
Eval results
Files

django-settings.mddocs/

Django Settings

Configuration system for Creme CRM with database, security, internationalization, media handling, and application-specific settings.

Capabilities

Database Configuration

Database connection and behavior settings.

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'creme_crm',
        'USER': 'creme_user',
        'PASSWORD': 'password',
        'HOST': 'localhost',
        'PORT': '5432',
        'OPTIONS': {
            'charset': 'utf8',
        },
    }
}

# Auto-incrementing field configuration
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

# Database connection timeout
DATABASE_CONNECTION_TIMEOUT = 600

Authentication & Security

User authentication and security configuration.

# Custom user model
AUTH_USER_MODEL = 'creme_core.CremeUser'

# Authentication backends
AUTHENTICATION_BACKENDS = [
    'creme.creme_core.backends.CremeBackend',
    'django.contrib.auth.backends.ModelBackend',
]

# Security settings
SECRET_KEY = 'your-secret-key-here'
DEBUG = False
ALLOWED_HOSTS = ['localhost', '127.0.0.1', 'your-domain.com']

# Session configuration
SESSION_COOKIE_AGE = 3600  # 1 hour
SESSION_SAVE_EVERY_REQUEST = True
SESSION_EXPIRE_AT_BROWSER_CLOSE = True

Media & File Handling

File upload and static file configuration.

# Media files (user uploads)
MEDIA_ROOT = '/var/creme/media'
MEDIA_URL = '/media/'

# Static files
STATIC_ROOT = '/var/creme/static'
STATIC_URL = '/static/'
STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'static'),
]

# File upload restrictions
ALLOWED_IMAGES_EXTENSIONS = ['jpg', 'jpeg', 'png', 'gif', 'bmp']
ALLOWED_EXTENSIONS = ['pdf', 'doc', 'docx', 'xls', 'xlsx', 'txt', 'csv']
MAX_UPLOAD_SIZE = 10 * 1024 * 1024  # 10 MB

# File storage backend
DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'

Job System Configuration

Background job processing settings.

# Job processing limits
MAX_JOBS_PER_USER = 2
PSEUDO_PERIOD = [1, 2, 3, 4]  # Job execution intervals

# Redis broker for job queue
JOBMANAGER_BROKER = {
    'HOST': 'localhost',
    'PORT': 6379,
    'DB': 0,
    'PASSWORD': None,
}

# Job timeout settings
JOB_TIMEOUT = 3600  # 1 hour default timeout
LONG_JOB_TIMEOUT = 7200  # 2 hours for long operations

Application Configuration

Creme-specific application settings.

# Installed Django applications
INSTALLED_DJANGO_APPS = [
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    # ... other Django apps
]

# Installed Creme applications
INSTALLED_CREME_APPS = [
    'creme.creme_core',
    'creme.persons',
    'creme.activities',
    'creme.billing',
    'creme.opportunities',
    'creme.commercial',
    'creme.documents',
    'creme.emails',
    'creme.products',
    'creme.reports',
    # ... other Creme apps
]

INSTALLED_APPS = INSTALLED_DJANGO_APPS + INSTALLED_CREME_APPS

# Data population configuration
POPULATORS = [
    'creme.creme_core.populators',
    'creme.persons.populators',
    'creme.activities.populators',
    # ... other populators
]

Model Configuration

Dynamic model settings for customization.

# Configurable model settings
PERSONS_CONTACT_MODEL = 'persons.Contact'
PERSONS_ORGANISATION_MODEL = 'persons.Organisation'
ACTIVITIES_ACTIVITY_MODEL = 'activities.Activity'
BILLING_INVOICE_MODEL = 'billing.Invoice'
BILLING_QUOTE_MODEL = 'billing.Quote'
DOCUMENTS_DOCUMENT_MODEL = 'documents.Document'

# Core system models
CREME_CORE_WSETTINGS_MODEL = 'creme_core.WorldSettings'

Email Configuration

Email backend and SMTP settings.

# Email backend
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'

# SMTP configuration
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = 'your-email@gmail.com'
EMAIL_HOST_PASSWORD = 'your-password'

# Default sender information
DEFAULT_FROM_EMAIL = 'noreply@yourcompany.com'
SERVER_EMAIL = 'admin@yourcompany.com'

Internationalization

Language and localization settings.

# Language configuration
LANGUAGE_CODE = 'en'
LANGUAGES = [
    ('en', 'English'),
    ('fr', 'Français'),
    ('es', 'Español'),
    ('de', 'Deutsch'),
]

# Timezone configuration
TIME_ZONE = 'UTC'
USE_TZ = True
USE_I18N = True
USE_L10N = True

# Translation files location
LOCALE_PATHS = [
    os.path.join(BASE_DIR, 'locale'),
]

Usage Examples

Basic Configuration

# settings.py for development
import os

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

# Database for development
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'creme.sqlite3'),
    }
}

# Debug mode
DEBUG = True
ALLOWED_HOSTS = ['localhost', '127.0.0.1']

# Media and static files
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')

Production Configuration

# settings.py for production
import os
from pathlib import Path

# Security settings
DEBUG = False
SECRET_KEY = os.environ.get('SECRET_KEY')
ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS', '').split(',')

# Database from environment
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': os.environ.get('DB_NAME'),
        'USER': os.environ.get('DB_USER'),
        'PASSWORD': os.environ.get('DB_PASSWORD'),
        'HOST': os.environ.get('DB_HOST', 'localhost'),
        'PORT': os.environ.get('DB_PORT', '5432'),
    }
}

# Redis configuration
JOBMANAGER_BROKER = {
    'HOST': os.environ.get('REDIS_HOST', 'localhost'),
    'PORT': int(os.environ.get('REDIS_PORT', '6379')),
    'DB': int(os.environ.get('REDIS_DB', '0')),
    'PASSWORD': os.environ.get('REDIS_PASSWORD'),
}

# File storage
MEDIA_ROOT = '/var/creme/media'
STATIC_ROOT = '/var/creme/static'

Custom Model Configuration

# Using custom models
PERSONS_CONTACT_MODEL = 'my_app.CustomContact'
PERSONS_ORGANISATION_MODEL = 'my_app.CustomOrganisation'

# Ensure custom apps are installed
INSTALLED_CREME_APPS = [
    'creme.creme_core',
    'my_app',  # Custom app with models
    'creme.persons',
    # ... other apps
]

Email Configuration Examples

# Gmail SMTP
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = 'your-email@gmail.com'
EMAIL_HOST_PASSWORD = 'your-app-password'

# Amazon SES
EMAIL_BACKEND = 'django_ses.SESBackend'
AWS_ACCESS_KEY_ID = 'your-access-key'
AWS_SECRET_ACCESS_KEY = 'your-secret-key'
AWS_SES_REGION_NAME = 'us-east-1'

# Console backend for development
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

Advanced Configuration

# Logging configuration
LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'handlers': {
        'file': {
            'level': 'INFO',
            'class': 'logging.FileHandler',
            'filename': '/var/log/creme/creme.log',
        },
        'console': {
            'level': 'DEBUG',
            'class': 'logging.StreamHandler',
        },
    },
    'root': {
        'handlers': ['console', 'file'],
        'level': 'INFO',
    },
}

# Cache configuration
CACHES = {
    'default': {
        'BACKEND': 'django_redis.cache.RedisCache',
        'LOCATION': 'redis://127.0.0.1:6379/1',
        'OPTIONS': {
            'CLIENT_CLASS': 'django_redis.client.DefaultClient',
        }
    }
}

# Session configuration
SESSION_ENGINE = 'django.contrib.sessions.backends.cached_db'
SESSION_CACHE_ALIAS = 'default'

Install with Tessl CLI

npx tessl i tessl/pypi-creme-crm

docs

activity-system.md

api-integration.md

billing-system.md

configuration-system.md

console-interface.md

contact-management.md

core-framework.md

django-settings.md

document-management.md

email-system.md

event-system.md

import-export-system.md

index.md

management-commands.md

plugin-development.md

product-catalog.md

reporting-system.md

sales-management.md

system-configuration.md

template-system.md

ticket-system.md

user-management.md

tile.json