开发者

Django apps urls.py access

开发者 https://www.devze.com 2023-01-17 08:42 出处:网络
I have one questions I have start project Sth. in sth project I have created app called misc. In view file in misc I have function index. When i try do render it i got NameError misc not found. Here i

I have one questions I have start project Sth. in sth project I have created app called misc. In view file in misc I have function index. When i try do render it i got NameError misc not found. Here is my urls.py

(r'^$'),misc.index, 

and here is how I add line for开发者_运维技巧 installed apps.

'Sth.misc',

I know that this is easy to do but I'm just beginning and can't handle it. Thanks for any help.


I think you should either import the misc module, or pass the function name as a string to patterns:

((r'^$'), 'misc.index'),
0

精彩评论

暂无评论...
验证码 换一张
取 消