URLField serializer is not playing nice with "built in" test server address http://testserver · encode/django-rest-framework · Discussion #9705 · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

URLField serializer is not playing nice with "built in" test server address http://testserver #9705

Discussion options

You must be logged in to vote
  • if I got it right such validation stems from DJANGO itself, so should it be checked/fixed there?

It does. I was able to reproduce the problem with a simpler test case:

from django.core.validators import URLValidator

def test_url_validator():
    validator = URLValidator()
    assert validator("http://testserver/path") is None  # fails
  • any way to workaround?

Change the base URL to something with a TLD? I usually have a constant in my settings to be able to switch it between test/dev/staging/prod. Django has the standard MEDIA_URL for media file, you can make up your own to fit your use case. This testserver doesn't come from DRF either, it's vanilla Django too.

Not much specific t…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@browniebroke
Comment options

@yarikoptic
Comment options

Comment options

You must be logged in to vote
1 reply
@yarikoptic
Comment options

Answer selected by browniebroke
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #9704 on May 21, 2025 07:26.

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.