Skip to content

Commit

Permalink
- Minor fixes to backup & restore commands
Browse files Browse the repository at this point in the history
  • Loading branch information
afabiani committed May 9, 2018
1 parent 463e971 commit 8d8cb54
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 8 deletions.
9 changes: 8 additions & 1 deletion geonode/base/management/commands/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,14 @@ def handle(self, **options):
print "Saved Static Files from '"+static_files_folder+"'."

# Store Template Folders
template_folders = settings.TEMPLATE_DIRS
template_folders = []
try:
template_folders = settings.TEMPLATE_DIRS
except:
try:
template_folders = settings.TEMPLATES[0]['DIRS']
except:
pass
template_files_folders = os.path.join(target_folder, helpers.TEMPLATE_DIRS)
if not os.path.exists(template_files_folders):
os.makedirs(template_files_folders)
Expand Down
9 changes: 8 additions & 1 deletion geonode/base/management/commands/restore.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,14 @@ def handle(self, **options):
static_folder = os.path.join(target_folder, helpers.STATIC_ROOT)
static_folders = settings.STATICFILES_DIRS
static_files_folders = os.path.join(target_folder, helpers.STATICFILES_DIRS)
template_folders = settings.TEMPLATE_DIRS
template_folders = []
try:
template_folders = settings.TEMPLATE_DIRS
except:
try:
template_folders = settings.TEMPLATES[0]['DIRS']
except:
pass
template_files_folders = os.path.join(target_folder, helpers.TEMPLATE_DIRS)
locale_folders = settings.LOCALE_PATHS
locale_files_folders = os.path.join(target_folder, helpers.LOCALE_PATHS)
Expand Down
4 changes: 2 additions & 2 deletions geonode/base/management/commands/settings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ dumprasterdata = yes
# dumps = people,accounts,avatars,backups,licenses,topiccategories,regions,spatialrepresentationtypes,restrictioncodetypes,resourcebases,contactroles,links,useropermissions,groupopermissions,uploadsessions,styles,layers,attributes,layerfiles,maps,maplayers,mapsnapshots,documents,tags

# 2.6+
apps = contenttypes,auth,people,groups,account,actstream,admin,agon_ratings,announcements,avatar,base,dialogos,documents,guardian,invitations,layers,maps,oauth2_provider,pinax_notifications,services,sessions,sites,taggit,tastypie,upload,user_messages
dumps = contenttypes,auth,people,groups,account,actstream,admin,agon_ratings,announcements,avatar,base,dialogos,documents,guardian,invitations,layers,maps,oauth2_provider,pinax_notifications,services,sessions,sites,taggit,tastypie,upload,user_messages
apps = contenttypes,auth,people,groups,account,guardian,admin,actstream,agon_ratings,announcements,avatar,base,dialogos,documents,geoserver,invitations,layers,maps,oauth2_provider,pinax_notifications,services,sites,socialaccount,taggit,tastypie,upload,user_messages
dumps = contenttypes,auth,people,groups,account,guardian,admin,actstream,agon_ratings,announcements,avatar,base,dialogos,documents,geoserver,invitations,layers,maps,oauth2_provider,pinax_notifications,services,sites,socialaccount,taggit,tastypie,upload,user_messages

# Migrate from GN 2.0 to GN 2.4
# migrations = base.resourcebase,layers.layer,layers.attribute,maps.map,maps.maplayer
Expand Down
9 changes: 8 additions & 1 deletion scripts/backup-restore/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,14 @@ def backup_full():
print "Saved Static Files from '"+static_files_folder+"'."

# Store Template Folders
template_folders = settings.TEMPLATE_DIRS
template_folders = []
try:
template_folders = settings.TEMPLATE_DIRS
except:
try:
template_folders = settings.TEMPLATES[0]['DIRS']
except:
pass
template_files_folders = os.path.join(target_folder, helpers.TEMPLATE_DIRS)
if not os.path.exists(template_files_folders):
os.makedirs(template_files_folders)
Expand Down
9 changes: 8 additions & 1 deletion scripts/backup-restore/restore.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,14 @@ def restore_full(archive):
print "Static Files Restored into '"+static_files_folder+"'."

# Restore Template Folders
template_folders = settings.TEMPLATE_DIRS
template_folders = []
try:
template_folders = settings.TEMPLATE_DIRS
except:
try:
template_folders = settings.TEMPLATES[0]['DIRS']
except:
pass
template_files_folders = os.path.join(target_folder, helpers.TEMPLATE_DIRS)

for template_files_folder in template_folders:
Expand Down
4 changes: 2 additions & 2 deletions scripts/backup-restore/settings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ passwd = geonode
# dumps = people,accounts,avatars,backups,licenses,topiccategories,regions,spatialrepresentationtypes,restrictioncodetypes,resourcebases,contactroles,links,useropermissions,groupopermissions,uploadsessions,styles,layers,attributes,layerfiles,maps,maplayers,mapsnapshots,documents,tags

# 2.6+
apps = contenttypes,auth,people,groups,account,actstream,admin,agon_ratings,announcements,avatar,base,dialogos,documents,guardian,invitations,layers,maps,oauth2_provider,pinax_notifications,services,sessions,sites,taggit,tastypie,upload,user_messages
dumps = contenttypes,auth,people,groups,account,actstream,admin,agon_ratings,announcements,avatar,base,dialogos,documents,guardian,invitations,layers,maps,oauth2_provider,pinax_notifications,services,sessions,sites,taggit,tastypie,upload,user_messages
apps = contenttypes,auth,people,groups,account,guardian,admin,actstream,agon_ratings,announcements,avatar,base,dialogos,documents,geoserver,invitations,layers,maps,oauth2_provider,pinax_notifications,services,sites,socialaccount,taggit,tastypie,upload,user_messages
dumps = contenttypes,auth,people,groups,account,guardian,admin,actstream,agon_ratings,announcements,avatar,base,dialogos,documents,geoserver,invitations,layers,maps,oauth2_provider,pinax_notifications,services,sites,socialaccount,taggit,tastypie,upload,user_messages

# Migrate from GN 2.0 to GN 2.4
# migrations = base.resourcebase,layers.layer,layers.attribute,maps.map,maps.maplayer
Expand Down

0 comments on commit 8d8cb54

Please sign in to comment.