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 hopes to raise $1bn with a convertible bond private placement

The super secure UAE-based Telegram messenger service, developed by Russian-born software icon Pavel Durov, is looking to raise $1bn through a bond placement to a limited number of investors from Russia, Europe, Asia and the Middle East, the Kommersant daily reported citing unnamed sources on February 18, 2021.The issue reportedly comprises exchange bonds that could be converted into equity in the messaging service that is currently 100% owned by Durov and his brother Nikolai.Kommersant reports that the price of the conversion would be at a 10% discount to a potential IPO should it happen within five years.The minimum bond placement is said to be set at $50mn, but could be lowered to $10mn. Five-year bonds could carry an annual coupon of 7-8%.

telegram from ca


Telegram جنگولرن
FROM USA