I'm currently facing an issue with configuring my Django application published in linode server using Nginx. My issue is in the app-ads.txt file for Google AdMob. I have set up a view in my views.py and added the corresponding URL pattern in urls.py as follows:
views.py
@require_GET
def ads_txt(request):
content = 'google.com, pub-*****************, DIRECT, ************'
return HttpResponse(content, content_type="text/plain")
urls.py
from django.urls import path
from .views import ads_txt
urlpatterns = [
path('app-ads.txt', ads_txt),
]
Problem:
The view works when I access the URL without a trailing slash (https://www.example.com/app-ads.txt), but I encounter a 404 Not Found error when I include the trailing slash (https://www.example.com/app-ads.txt/).
Question:
Which is the best configuration to my Django application to handle both cases the app-ads.txt URL? is it with or without the backslash as per the documentation without
Additionally, is there anything specific I need to do to ensure that Google's crawler can correctly detect changes to the domain URL?
How do I make sure that google console and app store has the url required for crawling maybe I added in some fields and missed some. Are there specific fields that is requirement to check if they are filled.
Any insights or suggestions would be greatly appreciated. Thank you!