This repository has been archived by the owner on Jan 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
/
djangomigration.py
executable file
·76 lines (64 loc) · 1.76 KB
/
djangomigration.py
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
INSTALLED_APPS = [
'django.contrib.contenttypes',
'django.contrib.auth',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'mptt',
'cms',
'menus',
'djangocms_grid',
'south',
]
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
LANGUAGE_CODE = 'en-us'
LANGUAGES = (
('en-us', 'English'),
)
SITE_ID = 1
TEMPLATE_CONTEXT_PROCESSORS = [
'django.core.context_processors.auth',
'django.core.context_processors.i18n',
'django.core.context_processors.request',
'django.core.context_processors.media',
'django.core.context_processors.static',
'cms.context_processors.media',
'sekizai.context_processors.sekizai',
]
ROOT_URLCONF = 'cms.urls'
MIGRATION_MODULES = {
'cms': 'cms.migrations_django',
'menu': 'menu.migrations_django',
'djangocms_grid': 'djangocms_grid.migrations_django',
}
def djangomigration():
# turn ``djangomigration.py`` into
# ``manage.py makemigrations djangocms_grid`` and setup the
# environment
from django.conf import settings
from django.core.management import ManagementUtility
settings.configure(
INSTALLED_APPS=INSTALLED_APPS,
ROOT_URLCONF=ROOT_URLCONF,
DATABASES=DATABASES,
TEMPLATE_CONTEXT_PROCESSORS=TEMPLATE_CONTEXT_PROCESSORS,
MIGRATION_MODULES=MIGRATION_MODULES,
LANGUAGE_CODE=LANGUAGE_CODE,
LANGUAGES=LANGUAGES,
SITE_ID=SITE_ID,
)
argv = list(sys.argv)
argv.insert(1, 'makemigrations')
argv.insert(2, 'djangocms_grid')
utility = ManagementUtility(argv)
utility.execute()
if __name__ == "__main__":
djangomigration()