1 | ### prelude to stand-alone-script
|
---|
2 | ### fixing http://code.djangoproject.com/ticket/1796
|
---|
3 | ### configure project_directory below
|
---|
4 |
|
---|
5 | project_directory = "/home/virtel/projekte/moblog/blogposter"
|
---|
6 |
|
---|
7 |
|
---|
8 | ### next few lines copied from django/core/management.py
|
---|
9 |
|
---|
10 | import os,sys
|
---|
11 | project_name = os.path.basename(project_directory)
|
---|
12 | sys.path.append(os.path.join(project_directory, '..'))
|
---|
13 | project_module = __import__(project_name, '', '', [''])
|
---|
14 | sys.path.pop()
|
---|
15 | os.environ['DJANGO_SETTINGS_MODULE'] = '%s.settings' % project_name
|
---|
16 |
|
---|
17 |
|
---|
18 | if not project_directory in sys.path :
|
---|
19 | sys.path.append(project_directory)
|
---|
20 |
|
---|
21 | ### start your script here
|
---|
22 |
|
---|