From dfebde5da17c1f8f7abb35b6da17b11fbebbee49 Mon Sep 17 00:00:00 2001 From: aaron Date: Wed, 29 Oct 2008 08:35:01 +0100 Subject: [PATCH] [svn r8043] Add Martin's reset script --- troggle/parsers/databaseReset.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 troggle/parsers/databaseReset.py diff --git a/troggle/parsers/databaseReset.py b/troggle/parsers/databaseReset.py new file mode 100644 index 000000000..97499b01b --- /dev/null +++ b/troggle/parsers/databaseReset.py @@ -0,0 +1,17 @@ +import os +os.environ['PYTHONPATH'] = 'c:\djangoprojects\verfification' +os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' +from django.core import management +from django.db import connection + +cursor = connection.cursor() +cursor.execute("drop database verification") +cursor.execute("create database verification") +cursor.execute("use verification") +management.call_command('syncdb') +from django.contrib.auth.models import User +user = User.objects.create_user('m', 'm@m.com', 'm') +user.is_staff = True +user.is_superuser = True +user.save() +#management.call_command('runserver')