如果django runserver似乎正在缓存我的urls.py和settings.py,该怎么办? [英] What can I do if django runserver seems to be caching my urls.py and settings.py?

查看:132
本文介绍了如果django runserver似乎正在缓存我的urls.py和settings.py,该怎么办?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



所以,使用urls.py我不会在URLConf中更新模式时发现这个问题在任何地方写任意行,我的意思是,无效的代码,并且django不会抛出任何异常,并提供URL只是罚款。



所以我检查了code> ROOT_URLCONF 在settings.py中,它指向 projectname.urls ,因此它正在读取正确的文件。我尝试删除urls.py,服务器保持运行并且正常运行。然后我删除settings.py,只是为了看看是否没有被读取,这给了我预期的异常。



我删除了所有* .pyc,重新启动runserver多次,甚至重启了整台电脑。我也尝试删除数据库并再次运行syncdb。



我创建了一个新的空项目,运行正常。


$ b $我运行最新的开发版本:
Django版本1.2 beta 1 SVN-12617,使用设置' cms.settings '



我要求任何帮助,如何覆盖这种行为,我的意思是,必须有一些配置错误。

解决方案

你没有运行你认为你正在运行的。检查你的 PYTHONPATH


I detected this problem when updating the patterns in URLConf and seeing that the new pattern wasn't matched anywhere.

So, with urls.py I don't get anywhere when writing random lines on it, I mean, invalid code, and django doesn't throw any exception and serves the urls just fine.

So I checked ROOT_URLCONF in settings.py, and it points to "projectname.urls" so it's reading the right file. I tried deleting urls.py, and the server keeps running and serving just fine. Then I deleted settings.py, just to see if it wasn't being read, and that gave me the expected exception.

I deleted all *.pyc too, restarted runserver many times, and even restarted the whole computer. I also tried deleting the db and running syncdb again.

I created a new empty project, and it runs just fine.

I'm running the latest development version: Django version 1.2 beta 1 SVN-12617, using settings 'cms.settings'

I am asking for any kind of help of how to override this behavior, I mean, there must be something that's misconfigured.

解决方案

You're not running what you think you're running. Check your PYTHONPATH.

这篇关于如果django runserver似乎正在缓存我的urls.py和settings.py,该怎么办?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆