char0n / django-brevisurl

Django app for shortening urls
Other
9 stars 10 forks source link

Local backend short url domain #10

Closed char0n closed 12 years ago

char0n commented 12 years ago

Problem:

We have a use case in which we use setting LOCAL_BACKEND_DOMAIN = 'http://shor.tr/'. With this settings all our shortened_url looks like this: 'http://shor.tr/df3k4'. When this url is executed, browser is redirected to url 'http://compete.domain.com/df3k4' where django with brevisurl is installed and handles the url and redirect to original_url hidden behing 'df3k4' token. But we also want to be able to generate shortened_url in format 'http://compete.domain.com/df3k4' directly. This is not currently possible and the solutions is the subject of this issue.

Solution:

connection = get_connection(domain='http://compete.domain.com/') short_url = shorten_url('http://http://compete.domain.com/very_long_url', connection=connection)

This way local backend is configured with custom domain. This solution is acceptable and very flexible.

char0n commented 12 years ago

Implemented as described.