django-hide-herokuapp
Django app for Heroku users designed to hide your *.herokuapp.com from search engine results.
Use case
You want to develop a website called artisanalraisinbeer.com using Django deployed on Heroku. You write a little bit of Django code and create a new Heroku app called artisanalraisinbeer to deploy to.
While developing, you can visit your site by going to this URL: http://artisanalraisinbeer.herokuapp.com
Eventually, you finish the first version of your website, buy the domain name artisanalraisinbeer.com, and set everything up so that you can view the site just by going to the following URL: http://www.artisanalraisinbeer.com
You can still visit http://artisanalraisinbeer.herokuapp.com, which is fine—but there’s one problem: you want your main site to show up in search results, not your .herokuapp.com site.
How it works
This app goes about this two ways: robots.txt and the X-Robots-Tag. Why both? To be double-plus sure… :eyes:
If herokuapp seems to be in the originating host of the user request, then we do two things:
Put the following in robots.txt:
User-agent: * Disallow: /
Set X-Robots-Tag in our response header to noindex, nofollow.
For search engines that respect these settings, they should start to ignore these sites in future crawls.
Quick start
Add 'hide_herokuapp' to your INSTALLED_APPS setting.
Add the HideHerokuappFromRobotsMiddleware middleware to your MIDDLEWARE_CLASSES like this:
MIDDLEWARE_CLASSES = ( ... 'hide_herokuapp.middleware.HideHerokuappFromRobotsMiddleware', )Include the hide_herokuapp URLs in your project’s urls.py like this:
urlpatterns = [ ... url(r'^', include('hide_herokuapp.urls')), ... ]alternatively, you may hook up the view directly:
from hide_herokuapp.views import herokuapp_robots_view urlpatterns = [ ... url(r'^robots\.txt$', herokuapp_robots_view), ... ]
Contribute
- PyPI (Downloads)
- Official repository
- Issue tracker
Metadata
Release files for django-hide-herokuapp 0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| django-hide-herokuapp-0.4.tar.gz | 4.8 kB | Without provenance | Details |
Release files / django-hide-herokuapp-0.4.tar.gz
| Download URL | django-hide-herokuapp-0.4.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c198ba99a18336f775a09cad36ec8ea4ec7d924827d25af28777f342dcdbb51a
|
|
BLAKE2b-256 checksum How to use checksums |
924a43f5c2bcb557b2340b5298d05d1ad3ccf7eeb2d6e18a20136c7927b8da47
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-hide-herokuapp 0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.