#30740: collectstatic tries to connect to database
-------------------------------------+-------------------------------------
Reporter: PaszaVonPomiot | Owner: nobody
Type: Bug | Status: new
Component: contrib.staticfiles | Version: 2.1
Severity: Normal | Resolution:
Keywords: collectstatic | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by PaszaVonPomiot):
* status: closed => new
* resolution: invalid =>
Comment:
As suggested I have moved querying part from models.py to admin.py and
used ModelForm class to modify form in admin panel. Unfortunately I got
the same error during collectstatic:
{{{
class AbcRulesForm(ModelForm):
ASSIGN_CHOICES = [(team, team) for team in
sorted(set(People.objects.all().values_list("SquadName", flat=True)))]
assignment = forms.ChoiceField(choices=ASSIGN_CHOICES)
class AbcRules2(admin.ModelAdmin):
form = AbcRulesForm
admin.site.register(AbcRules, AbcRules2)
}}}
{{{
File "/opt/app-root/src/vs/admin.py", line 51, in <module>
class AbcRulesForm(ModelForm):
File "/opt/app-root/src/vs/admin.py", line 52, in AbcRulesForm
ASSIGN_CHOICES = [(team, team) for team in
sorted(set(People.objects.all().values_list("SquadName", flat=True)))]
...
django.db.utils.OperationalError: ('HYT00', '[HYT00]
[unixODBC][Microsoft][ODBC Driver 13 for SQL Server]Login timeout expired
(0) (SQLDriverConnect)')
}}}
Above solution works on Windows but fails on RedHat.
Again 'collectstatic' should never connect to database.
--
Ticket URL: <https://code.djangoproject.com/ticket/30740#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/072.867ad592456061fa86a224438f680e55%40djangoproject.com.