Create 'bsmain' (for bugsink-main) app to hold commands

As had been noted on some of the commands, 'ingest' was not the best place for
them.  However, [project-level apps are not supported in
Django](https://forum.djangoproject.com/t/allow-project-to-have-management-commands/5220/2)
So just create a 'main' app. I want to qualify it as 'myproject-main' though, to avoid
further unqualified global namespace pollution. And I want to avoid prefixing with 'bugsink'
b/c that's annoying for tab-completion. So 'bs' it is.

I've moved all commands over; even though a case could be made that the "feeding" commands
(raise_exception, send_json, stress_test) are somewhat related to ingestion, that's not
a very good case :-)
This commit is contained in:
Klaas van Schelven
2025-01-23 11:49:39 +01:00
parent 7727bc6168
commit ae9cb209a5
19 changed files with 9 additions and 2 deletions

0
bsmain/__init__.py Normal file
View File

0
bsmain/admin.py Normal file
View File

6
bsmain/apps.py Normal file
View File

@@ -0,0 +1,6 @@
from django.apps import AppConfig
class BsmainConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "bsmain"

View File

View File

View File

@@ -4,7 +4,6 @@ from snappea.models import Task
class Command(BaseCommand): class Command(BaseCommand):
# "ingest" may not be the best place for this, but "bugsink" is not an app, so Django won't discover it.
def add_arguments(self, parser): def add_arguments(self, parser):
parser.add_argument( parser.add_argument(

View File

0
bsmain/models.py Normal file
View File

0
bsmain/tests.py Normal file
View File

0
bsmain/views.py Normal file
View File

View File

@@ -65,6 +65,7 @@ INSTALLED_APPS = [
] ]
BUGSINK_APPS = [ BUGSINK_APPS = [
'bsmain',
'phonehome', 'phonehome',
'users', 'users',
'theme', 'theme',

View File

@@ -23,7 +23,7 @@ from issues.models import IssueStateManager, Issue, TurningPoint, TurningPointKi
from bugsink.app_settings import override_settings from bugsink.app_settings import override_settings
from compat.timestamp import format_timestamp from compat.timestamp import format_timestamp
from compat.dsn import get_header_value from compat.dsn import get_header_value
from ingest.management.commands.send_json import Command as SendJsonCommand from bsmain.management.commands.send_json import Command as SendJsonCommand
from .views import BaseIngestAPIView from .views import BaseIngestAPIView
from .parsers import readuntil, NewlineFinder, ParseError, LengthFinder, StreamingEnvelopeParser from .parsers import readuntil, NewlineFinder, ParseError, LengthFinder, StreamingEnvelopeParser

View File

@@ -39,6 +39,7 @@ where = ["."]
include = [ include = [
"alerts*", "alerts*",
"api*", "api*",
"bsmain*",
"bugsink*", "bugsink*",
"compat*", "compat*",
"events*", "events*",