docs
0
# Management Commands
1
2
Django management commands for administrative tasks, system maintenance, user management, and development operations in Creme CRM.
3
4
## Capabilities
5
6
### Core System Commands
7
8
Essential commands for database setup and system management.
9
10
```python { .api }
11
# Database initialization
12
creme creme_populate
13
"""
14
Initialize database with default data, users, and configuration.
15
16
Options:
17
--verbosity=N Set verbosity level (0-3)
18
--interactive Prompt for user input
19
--skip-checks Skip system checks
20
--only-apps=APP1,APP2 Populate only specific apps
21
22
Creates:
23
- Default user roles and permissions
24
- Core relation types and property types
25
- Default currencies and VAT rates
26
- System configuration entries
27
- Sample data (if specified)
28
"""
29
30
# User management
31
creme creme_createstaffuser
32
"""
33
Create administrative staff user accounts.
34
35
Options:
36
--username=USERNAME Username for new staff user
37
--email=EMAIL Email address for user
38
--password=PASSWORD Password (prompts if not provided)
39
--role=ROLE Role name to assign
40
41
Features:
42
- Interactive prompts for missing information
43
- Password validation and strength checking
44
- Automatic staff and superuser flags
45
- Role assignment integration
46
"""
47
48
# Project initialization
49
creme creme_start_project PROJECT_NAME
50
"""
51
Initialize new Creme CRM project structure.
52
53
Arguments:
54
PROJECT_NAME Name of the new project
55
56
Options:
57
--template=TEMPLATE Project template to use
58
--extension=EXT Template file extensions to process
59
--name=NAME Name to replace in templates
60
61
Creates:
62
- Project directory structure
63
- Settings files and URL configuration
64
- Initial migrations and static files setup
65
"""
66
67
# Application management
68
creme creme_uninstall APP_LABEL [APP_LABEL ...]
69
"""
70
Remove application modules and associated data.
71
72
Arguments:
73
APP_LABEL Application names to remove
74
75
Options:
76
--force Skip confirmation prompts
77
--keep-data Preserve database tables
78
--remove-migrations Delete migration files
79
80
Operations:
81
- Remove apps from INSTALLED_APPS
82
- Delete migrations (optional)
83
- Remove database tables (optional)
84
- Clean up static files and configurations
85
"""
86
87
# Job management
88
creme creme_job_manager {start,stop,status,clear}
89
"""
90
Background job management and monitoring.
91
92
Commands:
93
start Start job processing
94
stop Stop job processing
95
status Show job queue status
96
clear Remove completed/failed jobs
97
98
Options:
99
--job-id=ID Manage specific job
100
--queue=QUEUE Operate on specific queue
101
--timeout=SECONDS Set operation timeout
102
"""
103
```
104
105
### Development and Testing Commands
106
107
Commands for development workflow and testing support.
108
109
```python { .api }
110
# Security key generation
111
creme build_secret_key
112
"""
113
Generate Django SECRET_KEY for production deployment.
114
115
Options:
116
--length=N Key length (default: 50)
117
--output=FILE Output file path
118
--format=FORMAT Output format (plain, env, python)
119
120
Returns:
121
Cryptographically secure random key suitable for production use.
122
123
Examples:
124
creme build_secret_key --output=.env --format=env
125
creme build_secret_key --length=100
126
"""
127
128
# Test data generation
129
creme entity_factory ENTITY_TYPE
130
"""
131
Create test entities for development and testing.
132
133
Arguments:
134
ENTITY_TYPE Type of entities to create (Contact, Organisation, etc.)
135
136
Options:
137
--count=N Number of entities to generate (default: 10)
138
--user=USERNAME Username to assign as owner
139
--random-data Use realistic fake data generation
140
--relate Create relationships between entities
141
142
Supports:
143
- Contact and Organization generation with realistic data
144
- Activity and event creation with proper scheduling
145
- Document and folder structures
146
- Product and service catalogs
147
- Opportunity and sales pipeline data
148
"""
149
```
150
151
### Internationalization Commands
152
153
Translation and localization management tools.
154
155
```python { .api }
156
# Find duplicate translations
157
creme i18n_duplicates
158
"""
159
Find duplicate translation strings across language files.
160
161
Options:
162
--locale=LOCALE Check specific locale (default: all)
163
--output=FORMAT Output format (text, json, csv)
164
--threshold=N Minimum occurrences to report
165
166
Reports:
167
- Identical translations in different contexts
168
- Potential consolidation opportunities
169
- Translation consistency analysis
170
- Memory usage optimization suggestions
171
"""
172
173
# Find missing translations
174
creme i18n_empty
175
"""
176
Find empty or missing translations in language files.
177
178
Options:
179
--locale=LOCALE Check specific locale (default: all)
180
--fix Automatically remove empty entries
181
--report=FILE Save report to file
182
--show-keys Display translation keys
183
184
Identifies:
185
- Empty translation strings
186
- Missing translations for available keys
187
- Untranslated strings in templates and code
188
- Orphaned translation entries
189
"""
190
191
# Translation overrides
192
creme i18n_overload
193
"""
194
Manage custom translation overrides.
195
196
Options:
197
--locale=LOCALE Target locale for overrides
198
--key=KEY Translation key to override
199
--value=VALUE New translation value
200
--import=FILE Import overrides from file
201
--export=FILE Export overrides to file
202
203
Features:
204
- Custom translation management
205
- Override system translations without modifying core files
206
- Maintain upgrade compatibility
207
- Bulk import/export operations
208
"""
209
210
# Validate plural forms
211
creme i18n_plural_forms
212
"""
213
Validate plural form expressions in translation files.
214
215
Options:
216
--locale=LOCALE Specific locale to validate
217
--fix Attempt to fix common errors
218
--verbose Show detailed validation results
219
220
Validates:
221
- Plural form syntax correctness
222
- Language-specific plural rules compliance
223
- Consistency across translation files
224
- Expression evaluation safety
225
"""
226
227
# Translation spell checking
228
creme i18n_spellcheck
229
"""
230
Spell check translation strings using language dictionaries.
231
232
Options:
233
--locale=LOCALE Target locale for checking
234
--dictionary=FILE Custom dictionary file
235
--ignore-words=WORDS Comma-separated words to ignore
236
--add-words Add unknown words to dictionary
237
--interactive Prompt for corrections
238
239
Features:
240
- Multiple language support with appropriate dictionaries
241
- Custom dictionary integration for technical terms
242
- Automatic exclusion of variables and markup
243
- Correction suggestions for misspelled words
244
- Integration with popular spell-checking libraries
245
"""
246
```
247
248
### Application-Specific Commands
249
250
Specialized commands for specific application modules.
251
252
```python { .api }
253
# Activities module
254
creme activities_create_default_calendars
255
"""
256
Create default calendar structure for activities module.
257
258
Options:
259
--user=USERNAME Create calendars for specific user (default: all)
260
--team-calendars Create shared team calendars
261
--colors=COLOR1,COLOR2 Specify calendar colors
262
--skip-existing Don't recreate existing calendars
263
264
Creates:
265
- Personal calendars for all users
266
- Team/department shared calendars
267
- Default calendar colors and visibility settings
268
- Appropriate calendar permissions structure
269
"""
270
271
# Data import system
272
creme crudity_action_factory
273
"""
274
Create CRUD actions for external data import system.
275
276
Options:
277
--entity-type=TYPE Target entity type for imports
278
--source=CONFIG Data source configuration file
279
--mapping=FILE Field mapping definition file
280
--format=FORMAT Input data format (csv, json, xml)
281
--validation=RULES Validation rules file
282
283
Features:
284
- Automated data import rule creation
285
- Configurable field mapping between source and target
286
- Data validation and transformation rules
287
- Error handling and logging configuration
288
- Batch processing setup for large datasets
289
"""
290
291
# Geolocation management
292
creme geolocation {update,import,export,geocode}
293
"""
294
Manage geolocation data and address geocoding.
295
296
Commands:
297
update Update existing location data
298
import Import geographic data from file
299
export Export location data
300
geocode Geocode addresses to coordinates
301
302
Options:
303
--provider=PROVIDER Geocoding service (google, openstreetmap, etc.)
304
--batch-size=N Processing batch size for bulk operations
305
--api-key=KEY API key for geocoding service
306
--timeout=SECONDS Request timeout for geocoding
307
--force Force update existing coordinates
308
309
Operations:
310
- Geocode existing contact and organization addresses
311
- Import/export geographic reference data
312
- Update location coordinates in bulk
313
- Configure and test map service integrations
314
"""
315
```
316
317
### System Maintenance Commands
318
319
Commands for ongoing system maintenance and optimization.
320
321
```python { .api }
322
# Database maintenance
323
creme cleanup_files
324
"""
325
Clean up orphaned files and optimize file storage.
326
327
Options:
328
--dry-run Show what would be deleted without deleting
329
--media-only Only clean media files
330
--static-only Only clean static files
331
--older-than=DAYS Only remove files older than N days
332
333
Operations:
334
- Remove orphaned media files not referenced in database
335
- Clean up temporary files and caches
336
- Optimize file storage structure
337
- Report storage usage statistics
338
"""
339
340
# Session cleanup
341
creme clearsessions
342
"""
343
Remove expired session data from database.
344
345
Standard Django command for cleaning up session storage.
346
Should be run regularly via cron job for performance.
347
"""
348
349
# Cache management
350
creme clear_cache
351
"""
352
Clear application caches and reset cached data.
353
354
Options:
355
--cache-alias=ALIAS Clear specific cache backend
356
--keys=PATTERN Clear keys matching pattern
357
--timeout=SECONDS Reset cache timeout values
358
359
Clears:
360
- Template caches and compiled templates
361
- Database query caches
362
- Application-specific cached data
363
- Static file version caches
364
"""
365
366
# Log management
367
creme rotate_logs
368
"""
369
Rotate and archive application log files.
370
371
Options:
372
--max-size=SIZE Maximum log file size before rotation
373
--keep=COUNT Number of archived logs to keep
374
--compress Compress archived log files
375
--verbose Show rotation operations
376
377
Features:
378
- Automatic log file rotation based on size or time
379
- Configurable retention policies
380
- Log compression to save disk space
381
- Integration with system log rotation tools
382
"""
383
```
384
385
### Backup and Migration Commands
386
387
Data backup, migration, and disaster recovery tools.
388
389
```python { .api }
390
# Data export
391
creme export_data
392
"""
393
Export CRM data for backup or migration purposes.
394
395
Options:
396
--format=FORMAT Export format (json, xml, csv)
397
--apps=APP1,APP2 Export specific applications only
398
--exclude=MODELS Exclude specific models
399
--output=FILE Output file path
400
--compress Compress output file
401
402
Exports:
403
- Complete database contents in structured format
404
- Selective data export by application or model
405
- Relationships and foreign key references
406
- File attachments and media content
407
"""
408
409
# Data import
410
creme import_data FILE
411
"""
412
Import CRM data from exported files.
413
414
Arguments:
415
FILE Path to data file to import
416
417
Options:
418
--format=FORMAT Input file format
419
--update Update existing records
420
--create-users Create missing user accounts
421
--skip-relations Skip relationship imports
422
--dry-run Validate import without applying changes
423
424
Features:
425
- Full database restoration from export files
426
- Selective import with conflict resolution
427
- User account and permission restoration
428
- Relationship and reference integrity checking
429
"""
430
431
# Database migration
432
creme migrate_from_version VERSION
433
"""
434
Migrate data structure from older Creme CRM versions.
435
436
Arguments:
437
VERSION Source version to migrate from
438
439
Options:
440
--backup Create backup before migration
441
--skip-checks Skip pre-migration validation
442
--force Force migration despite warnings
443
--preserve-ids Attempt to preserve entity IDs
444
445
Supports:
446
- Schema migration between major versions
447
- Data transformation and field mapping
448
- Custom field and entity type migration
449
- User permission and role migration
450
"""
451
```
452
453
## Usage Examples
454
455
### Development Workflow
456
457
```python
458
# Set up new development environment
459
creme migrate
460
creme creme_populate --verbosity=2
461
creme creme_createstaffuser --username=admin --email=admin@local.dev
462
creme collectstatic --noinput
463
464
# Generate test data
465
creme entity_factory Contact --count=50 --random-data
466
creme entity_factory Organisation --count=20 --relate
467
creme entity_factory Activity --count=100 --user=admin
468
469
# Start development server
470
creme runserver 8000
471
```
472
473
### Production Deployment
474
475
```python
476
# Production setup
477
creme collectstatic --noinput --clear
478
creme migrate --run-syncdb
479
creme compress # If using django-compressor
480
481
# Security
482
creme build_secret_key --output=/etc/creme/secret_key
483
creme check --deploy
484
485
# Background jobs
486
creme creme_job_manager start
487
```
488
489
### Maintenance Tasks
490
491
```python
492
# Daily maintenance (cron job)
493
creme clearsessions
494
creme cleanup_files --older-than=30
495
creme rotate_logs
496
497
# Weekly maintenance
498
creme clear_cache
499
creme i18n_empty --locale=all --fix
500
creme entity_factory --cleanup-orphans
501
502
# Monthly maintenance
503
creme optimize_database
504
creme backup_data --compress --output=/backup/monthly/
505
```
506
507
### Translation Workflow
508
509
```python
510
# Extract new strings
511
creme makemessages --locale=fr --extension=html,py,js
512
513
# Check translation quality
514
creme i18n_empty --locale=fr
515
creme i18n_duplicates --locale=fr
516
creme i18n_spellcheck --locale=fr --interactive
517
518
# Compile translations
519
creme compilemessages --locale=fr
520
```
521
522
These management commands provide comprehensive administrative capabilities for all aspects of Creme CRM deployment, maintenance, and development workflows.