Thanks guys.. Already solved it.
I guess the main reason of the problem is that I'm using Pycharm Community Edition.
I guess the main reason of the problem is that I'm using Pycharm Community Edition.
So the alert error not accurate.
Anyway I tried to py manage.py with some alerts, and worked.
for example:
I left it like that. And sitemap still works.
But now the new problem is when I submitted my sitemap.xml to google search console, I got this error.
I don't know why.
Even when I access the domain/sitemap.xml, the sitemap is showing.
Any suggestions?
Thanks
Thanks
On Wed, Sep 9, 2020 at 4:20 AM coolguy <cooldjangoprogrammer@gmail.com> wrote:
I did this long time ago and here is what i did...in settings.pySITE_ID = 1# Application definitionINSTALLED_APPS = [# ...'django.contrib.sites','django.contrib.sitemaps',]run migration i.e.>>> py manage.py migrate OR python manage.py migrateafter this step, sites application will be in sync with the database.create a file sitemaps.py in your blog application. Your sitemap.py seems okay to me.update your main project urls.py file....from django.contrib.sitemaps.views import sitemapfrom blog.sitemaps import BlogPostsSitemapsitemaps = {'posts' : BlogPostsSitemap,}urlpatterns = [....path('sitemap.xml', sitemap, {'sitemaps': sitemaps}, name='django.contrib.sitemaps.views.sitemap'),]Now run the development server and open (assuming you are using default configuration) http://127.0.0.1:8000/sitemaplets try...--On Tuesday, September 8, 2020 at 2:53:12 PM UTC-4 hanz...@gmail.com wrote:I followed a tutorial for creating django sitemap, but still got problems along the way.I've seen some videos, but didn't work.
Do you have any references for easy way creating django sitemap for blog posts?Sure it would help.
ThanksOn Wed, Sep 9, 2020 at 12:02 AM coolguy <cooldjango...@gmail.com> wrote:Not sure why you are importing this into your main project urls.py but its very straight forwardfrom blog.sitemaps import BlogPostsSitemapquestion... are you trying to map the application url here? then you should use path('xxxx/' , Include("blog.urls"))On Tuesday, September 8, 2020 at 4:39:05 AM UTC-4 hanz...@gmail.com wrote:Sorry, point no 1 needs to be revised..
1. In urls.py, I want to import BlogPostsSitemap--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0f74b537-3fa8-4725-8098-b602417ea41bn%40googlegroups.com.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/030f483b-fb0c-428c-ab8d-8e7d3b82eb40n%40googlegroups.com.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CANV3w%3DaDYQ5tGzNsr1r5bqCbcqAe5qEfnX7uBY%2BU2OK-%3DR09iw%40mail.gmail.com.


No comments:
Post a Comment