Yes, that's very fine. Thanx
در یکشنبه 26 مهٔ 2019، ساعت 15:55:55 (UTC+4:30)، Yoo نوشته:
>
> Are you in your application's urls.py or your project's urls.py? You need
> to be in your APPLICATION'S urls.py for this to work. Your application's
> folder has admin.py, apps.py, forms.py, etc.
>
> In your views.py, do you have "show" defined? Like:
> def show(request):
> context = {}
> render(request, 'index.html', context=context)
>
> *Here's the explanation:*
>
> I still recommend you do something like this in your urls.py:
> from django.urls import path
> from . import views
> path('', views.index, name='index'),
> This is just to make everything less confusing. The name, 'index,' is used
> in your templates. For example, if you have:
> <p><a href="{% url 'index' %}">Home Page</a></p>
> This is a hyperlink to the home page called "index."
> The views.index means "use this view called index" like so:
> def index(request):
> context ={}
> render(request, 'index.html', context=context)
> I'm assuming you're using a template called "index.html" to load
> everything in.
> I'd recommend you go to Mozilla's Django tutorial to learn a bit. They
> have some good explanations with phenomenal tutorials.
>
> Does that make sense?
>
> On Sunday, May 26, 2019 at 6:41:03 AM UTC-4, Saeed Pooladzadeh wrote:
>>
>> Can you please explain. But I have seen in one of my app it works with
>> just second one!!
>>
>> در یکشنبه 26 مهٔ 2019، ساعت 3:49:59 (UTC+4:30)، Yoo نوشته:
>>>
>>> First one. Usually I'd have it be views.index. Otherwise, the first one
>>> is perfectly fine. Need explanation?
>>>
>>> On Saturday, May 25, 2019 at 7:14:18 PM UTC-4, Saeed Pooladzadeh wrote:
>>>>
>>>> Hello
>>>>
>>>> Wich of them is the right method for url mapping:
>>>>
>>>> path('', views.show, name='index'),
>>>>
>>>> or
>>>>
>>>> path('index', views.show),
>>>>
>>>> Regards,
>>>>
>>>> Saeed
>>>>
>>>
--
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/6ddec4a7-a531-4bb6-b638-f1ee8bf303a6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.