Thanks guys.. Already solved it.
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:
[image: image.png]
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.
[image: image.png]
I don't know why.

Even when I access the domain/sitemap.xml, the sitemap is showing.

Any suggestions?

Thanks

On Wed, Sep 9, 2020 at 4:20 AM coolguy <[email protected]>
wrote:

> I did this long time ago and here is what i did...
>
> in settings.py
> SITE_ID = 1
> # Application definition
> INSTALLED_APPS = [
>            # ...
>            'django.contrib.sites',
>            'django.contrib.sitemaps',
> ]
>
> run migration i.e.
> >>> py manage.py migrate    OR     python manage.py migrate
> after 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 sitemap
> from blog.sitemaps import BlogPostsSitemap
>
> sitemaps = {
>         '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/sitemap
>
> lets try...
>
> On Tuesday, September 8, 2020 at 2:53:12 PM UTC-4 [email protected] 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.
>>
>> Thanks
>>
>>
>>
>> On Wed, Sep 9, 2020 at 12:02 AM coolguy <[email protected]> wrote:
>>
>>> Not sure why you are importing this into your main project urls.py but
>>> its very straight forward
>>>
>>> from blog.sitemaps import BlogPostsSitemap
>>>
>>> question... 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 [email protected]
>>> 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 [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/0f74b537-3fa8-4725-8098-b602417ea41bn%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/0f74b537-3fa8-4725-8098-b602417ea41bn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/030f483b-fb0c-428c-ab8d-8e7d3b82eb40n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/030f483b-fb0c-428c-ab8d-8e7d3b82eb40n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANV3w%3DaDYQ5tGzNsr1r5bqCbcqAe5qEfnX7uBY%2BU2OK-%3DR09iw%40mail.gmail.com.

Reply via email to