Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
477 views
in Technique[技术] by (71.8m points)

python - Django: How to restart webserver so that changes in sourcecode get applied

I using Eclipse with PyDev to develop Django Webapplication. I can start my webserver with

python manage.py runserver

and then I can test my webapplication locally in my browser. However everytime I change the sourcecode I have to restart eclipse so that these changes get applied in my webapplication.

I guess I have to somehow restart the webserver so that my sourceode gets interpreted again so that my changes get applied. But how do I do that? I couldnt find any command to do so.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Django dev server restarts it self when python code changes. This may not happed if you run it with noreload option

./manage.py runserver --noreload

Another case when the server is not reloaded automatically is when the files changes is not used by django. For example if you have syntax error in your admin.py django won't use it. And changing it won't restart the server. Have in mind that if you use eclipse debug you will have to run django with noreload because of an bug that does not relaunch the instance but starts a new one.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...