xaralis / django-static-sitemaps

Tool for generating sitemaps as static files to serve them from webserver instead of your Django application.
154 stars 73 forks source link

File paths are doubled in my case #62

Closed zry656565 closed 6 years ago

zry656565 commented 6 years ago

Environment

Django Settings

STATIC_ROOT = 'static/'
STATIC_URL = '/static/'

# noj is my app name
STATICSITEMAPS_ROOT_SITEMAP = 'noj.sitemap.sitemaps'
STATICSITEMAPS_PING_GOOGLE = False

Behaviors

It's fine to generate a sitemap index, and I can visit it in http://127.0.0.1:8000/sitemap.xml.

<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <sitemap>
    <loc>
      http://127.0.0.1:8000/static/sitemap-static-1.xml.gz
    </loc>
  </sitemap>
...
</sitemapindex>

But if I visit http://127.0.0.1:8000/static/sitemap-static-1.xml.gz, I would get a 404 there. I found that sitemap-static-1.xml.gz is generated actually in /static/static/sitemap-static-1.xml.gz

After some digging in the source codes, I figured out that I could get what I want after modifying this line https://github.com/xaralis/django-static-sitemaps/blob/e90e6fdddc26f9e0ea358f17722bb94ea2fb3dc8/static_sitemaps/generator.py#L153 to

path = filename

I don't know if it's the right way, and if there is a better way to do this. Need some help here. :joy:

xaralis commented 6 years ago

I will look into it once I have some time left. It's difficult now, holidays ..

xaralis commented 6 years ago

Looks like duplicate of #50. Can you confirm you're using boto storage?

zry656565 commented 6 years ago

No, I serve sitemaps by our own nginx.

xaralis commented 6 years ago

OK, thanks for the details. I'll see if I can grab some spare time to fix this.

zry656565 commented 6 years ago

Okay, take you time :P

xaralis commented 6 years ago

I've just tried this again with a test app and didn't run into it. Can you please verify it's still present in 4.6.0?

xaralis commented 6 years ago

This indeed seems to be related to #50 .