0

I have been changing some of my views templates urls lately, and switched from:

(r'^(?P<slug>[^\.]+)/view_post/$', 'view_post'),

to :

(r'^(?P<slug>[^\.]+)/post/$', 'post'),

in my blog application urls.py. And, though I did a syncdb and migrated my blog application with south, the new url doesn't seem to be considered by my sitemaps or the admin interface which redirects me on the old url when I'm clicking on view this article.

Oleiade
  • 6,156
  • 4
  • 30
  • 42

3 Answers3

2

If this is running under Apache, you would have to force-reload or restart apache for your changes to be applied.

Also, you don't have to syncdb or migrate your app when changing your urls.py map (unless you are running a custom add-on I don't know about).

Max
  • 6,901
  • 7
  • 46
  • 61
  • I'm actually using Nginx, and already restarted it and gunicorn many times. Unfortunately no effects... – Oleiade Apr 29 '11 at 15:50
1

How are you restarting Gunicorn? with -HUP? Sounds weird, but try killing it completely then restarting it. Also- you shouldn't need to restart Nginx, just gunicorn

#start command, stores pid in a file in /tmp
sudo python manage.py run_gunicorn -p /tmp/gunicorn.pid -b 127.0.0.1:8000 --daemon

#stop command
sudo kill `cat /tmp/gunicorn.pid` #note those aren't apostrophes, but the ~ key

#restart commad
sudo kill -HUP `cat /tmp/gunicorn.pid`

I write these as little scripts so that I can just call ./start ./stop ./restart from my main folder, makes it easier

j_syk
  • 6,511
  • 2
  • 39
  • 56
  • I was actually using supervisor to manage the gunicorn. Killed every gunicorn instances on the system and tried your way, but it didn't made it. Does gunicorn has any kind of cache maybe? – Oleiade Apr 29 '11 at 20:32
  • run `ps aux | grep gunicorn` and see what come up? (I'm assuming some sort of *nix OS) – j_syk Apr 29 '11 at 20:41
  • It may be safe to say that it's not the server at this point? one thing I do sometimes when I'm having problems with code updating, and I don't know how safe this is, but I'll delete the .pyc versions of files and then the .py recompile – j_syk Apr 29 '11 at 21:32
  • Well I've just tried that too but it doesn't seem to make it either. I'm starting to feel desperate. I've found a little trick in order to make the old url point on the new one. But I'd like to be able to remove the legacy... – Oleiade Apr 29 '11 at 21:41
0

Did you fix your urls from your template? In your template, I see two instances of:

<input type="hidden" name="next" value="{% url blog.views.view_post slug=post.slug %}" />

The above should be:

<input type="hidden" name="next" value="{% url blog.views.post slug=post.slug %}" />
Thierry Lam
  • 45,304
  • 42
  • 117
  • 144
  • Yes, I did and it doesn't seem to change anything. Plus, my sitemap isn't updating either, so I guess the problem comes from higher then the templates... Starting to get desperate ^^ – Oleiade Apr 30 '11 at 12:28
  • Can you post your sitemap code from your project `urls.py`? I believe it should look something like: http://docs.djangoproject.com/en/1.3/ref/contrib/sitemaps/#initialization. I want to see the content of the `sitemaps` variable. – Thierry Lam Apr 30 '11 at 12:36