我在开发服务器上生成了 sitemap.xml,但是我在他的 URL 中得到了 example.com 而不是 127.0.0.1。我在对 example.com 的代码引用中没有任何位置。
-<urlset>
-<url>
<loc>http://example.com/xxxx/ABCDE/</loc>
-</url>
-</urlset>
什么需要改变,在哪里?谢谢
urls.py
from django.contrib import admin
from django.urls import path, include
from django.conf.urls.i18n import i18n_patterns
from django.contrib.sitemaps.views import sitemap
from ael.sitemaps import StaticViewSitemap, CrossRefTableSitemap
from ael import views as ael_views
from django.contrib.sitemaps import views as sitemaps_views
from django.views.decorators.cache import cache_page
sitemaps = {
'static': StaticViewSitemap,
'crossreftable': CrossRefTableSitemap,
}
urlpatterns = [
path('admin/', admin.site.urls),
path('i18n/', include('django.conf.urls.i18n')),
path('sitemap.xml',
cache_page(86400)(sitemaps_views.index),
{'sitemaps': sitemaps, 'sitemap_url_name': 'sitemaps'}),
path('sitemap-<section>.xml',
cache_page(86400)(sitemaps_views.sitemap),
{'sitemaps': sitemaps}, name='sitemaps'),
path('start_page/', ael_views.start_page, name='start_page'),
path('search_form/', ael_views.search_form, name = 'search_form'),
path('smap_detail/<str:smapnr>/', ael_views.smap_detail, name = 'smap_detail'),
]
urlpatterns += i18n_patterns(
path('ael/', include('ael.urls')),
)