Telegram Group & Telegram Channel
یه نکته در مورد include در urls.py

عکس رو ببینید. من برای path ها namespace تعریف کردم.

✔️متد include میگه اگه namespace تعریف کنی، باید برای app ت هم app_name تعریف کنی.

وگرنه خطای زیر رو میده:

 Specifying a namespace in include() without providing an app_name is not supported. Set the app_name attribute in the included module, or pass a 2-tuple containing the list of patterns and app_name instead.


برای حل این مشکل
(مثلا فرض کن میخوای name برای path یی داشته باشی که توی urls.py اصلی پروژه اس)

اینجوری باید path رو اوکی کنی:

path("felan-url/", include(("felan_app", "felan_name"))),


دقت کن. یه tuple برای include فرستادم.

اینجوری دیگه توی تمپلت می تونم با app_name ع felan_name به اسم path های اون اپ دسترسی داشته باشم (به شرطی که name داشته باشن).

پیچیده گفتم؟ برو کد include رو بخون، متوجه منظورم میشی.



tg-me.com/djangolearn_ir/992
Create:
Last Update:

یه نکته در مورد include در urls.py

عکس رو ببینید. من برای path ها namespace تعریف کردم.

✔️متد include میگه اگه namespace تعریف کنی، باید برای app ت هم app_name تعریف کنی.

وگرنه خطای زیر رو میده:

 Specifying a namespace in include() without providing an app_name is not supported. Set the app_name attribute in the included module, or pass a 2-tuple containing the list of patterns and app_name instead.


برای حل این مشکل
(مثلا فرض کن میخوای name برای path یی داشته باشی که توی urls.py اصلی پروژه اس)

اینجوری باید path رو اوکی کنی:

path("felan-url/", include(("felan_app", "felan_name"))),


دقت کن. یه tuple برای include فرستادم.

اینجوری دیگه توی تمپلت می تونم با app_name ع felan_name به اسم path های اون اپ دسترسی داشته باشم (به شرطی که name داشته باشن).

پیچیده گفتم؟ برو کد include رو بخون، متوجه منظورم میشی.

BY جنگولرن




Share with your friend now:
tg-me.com/djangolearn_ir/992

View MORE
Open in Telegram


telegram Telegram | DID YOU KNOW?

Date: |

Telegram has exploded as a hub for cybercriminals looking to buy, sell and share stolen data and hacking tools, new research shows, as the messaging app emerges as an alternative to the dark web.An investigation by cyber intelligence group Cyberint, together with the Financial Times, found a ballooning network of hackers sharing data leaks on the popular messaging platform, sometimes in channels with tens of thousands of subscribers, lured by its ease of use and light-touch moderation.telegram from de


Telegram جنگولرن
FROM USA