From 876868506f9a01ff49e25c501f92a4e89d2a0ffe Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Sat, 10 Apr 2021 01:14:23 +0100 Subject: [PATCH] tidy obsolete troggle/code/reset_db --- core/management/commands/dummycmd.py | 30 ++++++++++++++++++++++++++ core/management/commands/reset_db.py | 32 ---------------------------- debian/sitecustomize.py | 7 ++++++ debian/wookey-exposerver-recipe.txt | 11 ++++++++++ media/admin/img/django-admin | 5 +++++ 5 files changed, 53 insertions(+), 32 deletions(-) create mode 100644 core/management/commands/dummycmd.py delete mode 100644 core/management/commands/reset_db.py create mode 100644 debian/sitecustomize.py create mode 100644 media/admin/img/django-admin diff --git a/core/management/commands/dummycmd.py b/core/management/commands/dummycmd.py new file mode 100644 index 0000000..0721ec6 --- /dev/null +++ b/core/management/commands/dummycmd.py @@ -0,0 +1,30 @@ +import os +from optparse import make_option + +from django.db import connection +from django.core import management +from django.core.management.base import BaseCommand, CommandError +from django.contrib.auth.models import User + +import settings + +"""this is now replaced by databaseRest.py +I don't know why this still exists. Needs testing to see if +removing it makes django misbehave. +""" + +class Command(BaseCommand): + def add_arguments(self, parser): + # Positional arguments + parser.add_argument('posargs', nargs='+', type=int) + + # Named (optional) arguments + parser.add_argument( + '--delete', + action='store_true', + help='Removed as redundant - use databaseReset.py', + ) + + def handle(self, *args, **options): + print(args) + print(options) diff --git a/core/management/commands/reset_db.py b/core/management/commands/reset_db.py deleted file mode 100644 index 83cc97b..0000000 --- a/core/management/commands/reset_db.py +++ /dev/null @@ -1,32 +0,0 @@ -import os -from optparse import make_option - -from django.db import connection -from django.core import management -from django.core.urlresolvers import reverse -from django.core.management.base import BaseCommand, CommandError -from django.contrib.auth.models import User - -from troggle.core.models import Cave, Entrance - -import settings - -"""Pretty much all of this is now replaced by databaseRest.py -I don't know why this still exists. Needs testing to see if -removing it makes django misbehave. -""" - -class Command(BaseCommand): - help = 'Removed as redundant - use databaseReset.py' - - option_list = BaseCommand.option_list + ( - make_option('--reset', - action='store_true', - dest='reset', - default=False, - help='Removed as redundant'), - ) - - def handle(self, *args, **options): - print(args) - print(options) diff --git a/debian/sitecustomize.py b/debian/sitecustomize.py new file mode 100644 index 0000000..89c6712 --- /dev/null +++ b/debian/sitecustomize.py @@ -0,0 +1,7 @@ +# install the apport exception handler if available +try: + import apport_python_hook +except ImportError: + pass +else: + apport_python_hook.install() diff --git a/debian/wookey-exposerver-recipe.txt b/debian/wookey-exposerver-recipe.txt index f548060..ab2fa60 100644 --- a/debian/wookey-exposerver-recipe.txt +++ b/debian/wookey-exposerver-recipe.txt @@ -82,3 +82,14 @@ I've tweaked the apache and mysql settings to make them a bit more suitable for https://www.narga.net/optimizing-apachephpmysql-low-memory-server/ (just discovered 'ab' for running apache performance tests - handy). + +Do the edit to site-packages/django/db/backends/base.py +to comment out the requirement for mysqlclient >1.3.13 +as we run perfectly happily with Django 2.2.19 & mysqlite 1.3.10 +: + +version = Database.version_info +#test nobbled by Wookey 2021-04-08 as 1.3.13 is not available on stable +#if version < (1, 3, 13): +# raise ImproperlyConfigured('mysqlclient 1.3.13 or newer is required; you have %s.' % Database.__version__) + diff --git a/media/admin/img/django-admin b/media/admin/img/django-admin new file mode 100644 index 0000000..53c32d6 --- /dev/null +++ b/media/admin/img/django-admin @@ -0,0 +1,5 @@ +#!/usr/bin/env python3 +from django.core import management + +if __name__ == "__main__": + management.execute_from_command_line()