diff --git a/django_countries/fields.py b/django_countries/fields.py
index <HASH>..<HASH> 100644
--- a/django_countries/fields.py
+++ b/django_countries/fields.py
@@ -103,6 +103,8 @@ class Country(object):
             flag_url = settings.COUNTRIES_FLAG_URL
         url = flag_url.format(
             code_upper=self.code, code=self.code.lower())
+        if not url:
+            return ''
         url = urlparse.urljoin(settings.STATIC_URL, url)
         return self.maybe_escape(url)
 
diff --git a/django_countries/tests/test_fields.py b/django_countries/tests/test_fields.py
index <HASH>..<HASH> 100644
--- a/django_countries/tests/test_fields.py
+++ b/django_countries/tests/test_fields.py
@@ -8,7 +8,7 @@ from django.utils import translation
 from django.utils.encoding import force_text
 try:
     from unittest import skipIf
-except:
+except ImportError:
     from django.utils.unittest import skipIf
 
 from django_countries import fields, countries
@@ -216,6 +216,10 @@ class TestCountryObject(TestCase):
         country = fields.Country(code='XX')
         self.assertEqual(country.numeric_padded, None)
 
+    def test_empty_flag_url(self):
+        country = fields.Country(code='XX', flag_url='')
+        self.assertEqual(country.flag, '')
+
 
 class TestModelForm(TestCase):
If empty flag_url is given to a Country object, flag should be blank