Reputation: 35
I am using Django Countries and the CountrySelectWidget to show the country flag after the CountryField on my form.
This works fine when Debug is set to True and I can see the flag fine. However when Debug is set to False the flag image shows as broken. I have set my static files and media files to be collected and served when DEBUG is False but I don't think that the CountrySelectWidget involves static files.
Django Countries is installed on my Django environment and the CountryField is working fine both when Debug is True and when it is False. So I don't know why the Widget doesn't seem to be working properly when Debug is False.
My forms.py is as follows:
from django import forms
from django_countries.widgets import CountrySelectWidget
from catalog.models import emaillist
class Subscribe(forms.ModelForm):
class Meta:
model = emaillist
fields = "__all__"
widgets = {'country': CountrySelectWidget()}
And my model is:
class EmailList(models.Model):
email = models.EmailField()
country = CountryField(blank_label='(select country)', default = 'South Africa')
def get_absolute_url(self): # new
return reverse('download-file')
I'm using Django 3.1.7
If you can help me I would be very grateful!
Best wishes,
Cameron
Upvotes: 1
Views: 179