Discussion on: How to add sitemap.xml to your Django Blog and make it work on Heroku (SEO)

radualexandrub profile image
Radu-Alexandru B Author

Do you have any "Sites" model when you are accessing the admin panel from domain.com/admin (from deployment)? If not, you should open your terminal and call (after you added sitemap configurations as shown in this post):

> heroku run bash
$ python manage.py migrate
> heroku restart

This was my solution to fixing the problem that you have. However, if you do have a "Sites" model in your admin panel, try accessing it and change the first entry from example.com to yourdomain.com. Furthermore, check that you have the corresponding settings in YourDjangoApp/settings.py:

SECRET_KEY = os.environ.get('SECRET_KEY')
DEBUG = (os.environ.get("DEBUG_VALUE") == "True")
ALLOWED_HOSTS = ["yourdomain.com",

Also, recheck your MainApp/urls.py as shown in this post's mini-tutorial.
Hope you will find a solution to your problem... Good luck!

dumdum profile image
dum dum

I've checked everything, I did what you told me.
Still got error 500 in production. :(

Argh.. I spent months finding this solutions.
Also, I have another problem about environment variables in Windows.
I put my secret key in my environment variables, I set my settings.py, then I ran py manage.py runserver.

I got error "django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty."

I don't know what to do. :(