Skip to content
This repository has been archived by the owner on May 4, 2020. It is now read-only.

Commit

Permalink
Change database paths absolute.
Browse files Browse the repository at this point in the history
Committed by noraesae.
  • Loading branch information
Hyeonje Alex Jun committed Aug 26, 2012
1 parent a8421a9 commit f16952c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions mahjong/auths/views.py
Expand Up @@ -5,6 +5,8 @@
from django.http import Http404, HttpResponseRedirect, HttpResponse
from django.shortcuts import render

from mahjong.settings import SQLITE3_BACKUP_PATH

from datetime import datetime

import shutil, os
Expand Down Expand Up @@ -60,10 +62,10 @@ def backupdb_proc(request):
raise Http404

try:
os.mkdir("../sqlite3backups")
os.mkdir(SQLITE3_BACKUP_PATH)
except OSError:
pass

shutil.copyfile('mahjong-sqlite3', '../sqlite3backups/mahjong-sqlite3-backup-' + datetime.now().strftime('%Y%m%d%H%M%S'))
shutil.copyfile('mahjong-sqlite3', os.path.join(SQLITE3_BACKUP_PATH, 'mahjong-sqlite3-backup-' + datetime.now().strftime('%Y%m%d%H%M%S')))

return HttpResponse('Database backuped')
4 changes: 3 additions & 1 deletion mahjong/mahjong/settings.py
Expand Up @@ -13,14 +13,16 @@
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'mahjong-sqlite3', # Or path to database file if using sqlite3.
'NAME': '/var/www/mahjong/mahjong-sqlite3', # Or path to database file if using sqlite3.
'USER': '', # Not used with sqlite3.
'PASSWORD': '', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
}

SQLITE3_BACKUP_PATH = '/var/www/sqlite3backups'

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
Expand Down

0 comments on commit f16952c

Please sign in to comment.