Hello guys,

I'm using build_absolute_uri() in order to create the beginning of my 
download link which is sent by email.

I'm working with django 1.11.20

*My code :*

I have in my code, this view which let to create my url :

    
class FileExport(View):
    
        def my_export(self, request, **kwargs):
            kwargs['user_email'] = request.user.email
            kwargs['user'] = request.user.name
            kwargs['url'] = request.build_absolute_uri(reverse('home'))
            my_export.delay(query_params=request.GET, **kwargs)
            
            return render(request, 'app/celery_export.html')



My url kwargs returns : *http://localhost:8000/*

The kwargs['url'] is used to create my download link in my message.html 
file :

    
<a href="{{ url }}{% url 'app:export_download' token=token %}">Download 
link to your export file</a>


I have my project urls.py file :

   
urlpatterns = [
        url(r'^$', RedirectView.as_view(pattern_name='app:home'), name=
'home'),]


I have my urls.py app file like this :

   
app_name = 'app'
    
    urlpatterns = [
        url(r'^home$', HomeView.as_view(), name='home'),
    
        url(r'^export/(?P<model>[-\w]+)/(?P<search_info>.*)/$', FileExport.
as_view(), name='my_export'),
        url(r'^export/(?P<model>[-\w]+)/$', FileExport.as_view(), name=
'my_export'),
        url(r'^download_export/(?P<token>.*)/$', ExportDownloadView.as_view
(), name='export_download'),
    ]


*My issue :*

When I receive the email, the link generated inside looks like this :

http://localhost:8000//download_export/<my_file>/


As you can see, I'm getting this* //* which create an issue. By removing 
one, it works.

It works on my qualification environment (distant server), but not in 
localhost. Do you have some ideas ?

Thank you !


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5a910425-be5f-419c-a9ca-3fec62199112%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to