tags:

views:

39

answers:

1

Really basic question. Learning Django and now working on development server with nginx set up for me. I've edited my urls.py file in my django project but its not registering the change. Do i need to restart nginx every time I edit the urls.py file? I don't have root access so this wouldn't be possible or is there a local level way of doing it?

EDIT: Turns out there was an answer. I just needed to touch the .wsgi file for my site.

+2  A: 

Yes, you need to restart the server every time you make a code change.

This is why you should do development using the built-in development server - this is what it's for. It restarts for you more-or-less automatically whenever you make a code change. When things are much more stable, you can move to using an external server that will need restarting.

Alternatively, there might be a way of getting nginx to restart itself on code change - it's certainly possible with Apache and mod_wsgi.

Daniel Roseman
Thats seems a bit stupid to me. that tightly couples your development code to your webserver. I though the whole idea of django was to have the opposite. I have set up my code locally but I'm looking to make changes now on dev server.
Derek Organ
It's not exclusively a Django thing, I think. All of the .py files get compiled to .pyc files and often don't get refreshed until you restart the server. So it's not just the url.py files that are doing it, it can be any of them. Which is why it's a smart idea to restart the server no matter which files you've edited and changed. Annoying, but true.
Jordan Reiter
thanks, that is annoying. What if a guys wanted to allow a bunch of students host there own django project on a web server but not give them root access. Surely it makes sense to allow for this type of scenario. you shouldn't need root access to develop a django app. just my thoughts on it if thats the way it is, not much i can do now only wait util my friend is back with root access.
Derek Organ
This has nothing to do with django, is about the way mod_wsgi works. Others I know like mod_python and mod_perl have the same issue.-------Edit----------Sorry I had the page open and did not see Jordan Reiter answer.
juanefren
I just think there should be a local way of handling it. E,g. on apache the mod rewrite can be written in a local .htacess file with no requirement to restart the server.
Derek Organ
turns out there was an answer. I just needed to touch the .wsgi file for my site.
Derek Organ