开发者

django site doesn't see urls.py

I just moved my site to an actual apache server (was developing locally before) and the site can't seem to find the urls.py file. basically what happens is that the homepage works, which is weird in itself considering that if i go to any url, e.g. website/about/, i will get a 404 error with text {'path': u'about/'}.

I tried ROOT_URLCO开发者_JAVA技巧NF set to mysite.urls and just urls, and if i move the urls.py it will continue to behave the same way.

I don't know if its related but I also can't seem to access my site media folder, it seems as though the server is still reading it in its old path, but the settings.py file is correct. (tried restarting apache, rebooting server, etc..)


I would be more worried about it not finding the media directory, that's pure apache. If that part of the equation isn't working, nothing else will. Work with apache's httpd.conf until you can browse to the media directory correctly first.

Update:

I copied in my working conf file and substituted your values. Your django.root might need to be "" or not set at all, as I've found that it shouldn't end with a /:

<Location "/">
  SetHandler python-program
  PythonHandler django.core.handlers.modpython
  SetEnv DJANGO_SETTINGS_MODULE fikdusite.settings
  PythonOption django.root ""
  PythonDebug On
  PythonPath "['/django_apps/', '/django_apps/fikdusite/'] + sys.path"
</Location>

And make sure that the .profile of the user that apache runs your site as, has:

export DJANGO_SETTINGS_MODULE='fikdusite.settings'
export PYTHONPATH=$PYTHONPATH:/django_apps:/django_apps/fikdusite


First, don't use mod_python, use mod_wsgi.

Secondly, don't forget that you need to restart Apache every time you make a code change in Django.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜