Displaying Ads on Python Flask Sites π
How come Google AdSense is not detecting my ads.txt
file? π
tl;dr Needs a route.
AdSense πͺ§
β
You've signed up for AdSense
β
AdSense has approved your site
β AdSense is not detecting your ads.txt file
Showing my Age π½
The AdSense instructions state to put the ads.txt
file in the root of your sites filesystem. So, me thinking of the old bare metal π€
days puts it there, but AdSense can't find it. Well the bare metal days are gone and this is a flask
app, in Docker containers, behind a proxy, and a load balancer; phew π
.
Create a Route β¨
The solution is to create a route in your flask app that serves the ads.txt
file.
1 2 3 |
|
Then place the ads.txt
file in the static/
directory of your flask app.
Success π
Now AdSense can find the ads.txt
β
. Once you know you know. Have fun out there on the internet folks. πΈοΈ