▲ 1 r/djangolearning+1 crossposts

Please help. From . import views not working

Hi. I hope you are having a great day so far. I am a django beginner and I was trying to learn django using the official tutorial and the youtube course by BugBytes. The problem is, I keep on getting stuck on the first page of the tutorial. I have tried 3 times with 3 different folders and nothing seems to work. Could you please help me out?

Here's the code:

Note: The file is urls.py inside the app, just like the tutorial specified. In fact, this is just copy pasted from the tutorial.from django.urls import path


from . import views


urlpatterns = [
    path("", views.index, name="index"),
]

I keep on getting the following error:

from . import views

ImportError: attempted relative import with no known parent package

Here's a screenshot of my folder structure.

My main folder is named Django, please do not confuse it with something else

What do I do? I have tried replacing . with the main file name (polls). It hasn't worked either. I also made sure to download Django v6.0. Still didn't work. I would appreciate any advice on how to solve this. Thank you for your time. Have a nice day!

--------------------------------------------------------------------

Here's some extra info just in case:

from django.shortcuts import render


from django.http import HttpResponse



def
 index(request):
    return HttpResponse("Hello, world. You're at the polls index.")

Note: This file is in the views.py file inside the app. It has also been copy pasted from the website. No errors are being flagged in it.

The page for the tutorial is this one: https://docs.djangoproject.com/en/6.0/intro/tutorial01/#write-your-first-view

If you scroll down to the section 'Write your first view', you shall find the exact code that I have used.

reddit.com
u/Ok_Equivalent1870 — 10 days ago

We have got to stop doing this.

Hi, another Shinobu maniac here.

I recently came across this subreddit and there is something that simply must be stopped. Dishonouring Shinobu by supporting artwork that goes against her morals is stupid and counter-productive .To be clear, I am talking about hentai.

Shinobu has been explicitly against perverts in the manga, and by posting hentai in this subreddit we basically insult her instead of worshipping her. If she were here to see those images, I am almost certain that she would hate us and the artists.

Therefore, as a community built for Shinobu, we need to stop supporting hentai artwork of her. Because we love Shinobu, we would never do anything that would upset/irritate/anger her. So let's end this abomination. For our cult. For our love. For Shinobu!

P.S. : No hate towards anyone in the community, it's more about the idea itself. I understand that everyone here loves Shinobu, and for that very reason I believe that everyone will choose to do the right thing for her.

Extra P.S. : I first posted this in the r/CultofShinobu and the people were decent and loving enough to take action. I believe that this community too has a deep love for Shinobu and that the right decision will be made.

reddit.com
u/Ok_Equivalent1870 — 18 days ago

Wait, what's the point of all of this?

Hi, 10th grader here. So I heard that the IOQM is super important so I began preparing for it. But now I am wondering, why exactly is it important? Could someone please explain this to me?

reddit.com
u/Ok_Equivalent1870 — 19 days ago

We have got to stop doing this.

Hi, another Shinobu maniac here.

I recently came across this subreddit and there is something that simply must be stopped. Dishonouring Shinobu by supporting artwork that goes against her morals is stupid and counter-productive**.** To be clear, I am talking about hentai.

Shinobu has been explicitly against perverts in the manga, and by posting hentai in this subreddit we basically insult her instead of worshipping her. If she were here to see those images, I am almost certain that she would hate us and the artists.

Therefore, as a community built for Shinobu, we need to stop supporting hentai artwork of her. Because we love Shinobu, we would never do anything that would upset/irritate/anger her. So let's end this abomination. For our cult. For our love. For Shinobu!

P.S. : No hate towards anyone in the community, it's more about the idea itself. I understand that everyone here loves Shinobu, and for that very reason I believe that everyone will choose to do the right thing for her.

reddit.com
u/Ok_Equivalent1870 — 19 days ago

A request to all scalers

I am no moderator. I literally discovered this reddit a few days ago. But you know what is really saddening? People hating on characters just because they are stronger than their favourite or just because the character is weak. This honestly needs to stop.

Demon Slayer - while being a violent anime - is a story that shows us what true peopl are. People who have gone through horrible things and still have stood up. The series is a testament to the idea that true strength lies in moving forward and bearing emotional pain, not in muscles and fights. Hating on character simply because they are 'weak' is not only stupid but a disrespect to the character themselves. If you think about it, according to the logic weak = deserves hate, every demon slayer would hate you. How would that feel?

Let's all collectively agree to stop aggressively slandering characters just to depict them as weak. If they are weak (according to you) then just say it. Stop insulting them to get your point across, its injustic to the character and the series' themes.

I would like to call out all the people who are making silly nicknames such as 'shinobum' or calling characters swear words. Stop it. If you truly love demon slayer and think of yourself as a morally right person, just stop.

Thanks.

reddit.com
u/Ok_Equivalent1870 — 1 month ago