Oleiade
Oleiade

Reputation: 6274

Django Templates urls not updating

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.

Upvotes: 0

Views: 2558

Answers (3)

Thierry Lam
Thierry Lam

Reputation: 46264

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 %}" />

Upvotes: 0

j_syk
j_syk

Reputation: 6621

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

Upvotes: 1

Max
Max

Reputation: 7119

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).

Upvotes: 2

Related Questions