Django: restarting the web server so that the changes in the source code are applied

I am using Eclipse with PyDev to develop Django Webapplication. I can start my web server using

python manage.py runserver 

and then I can test my application in a local browser. However, every time I change the source code, I need to restart eclipse so that these changes are applied in my web application.

I think I need to somehow restart the web server so that my source code is interpreted again in order to apply my changes. But how do I do this? I could not find any team for this.

+1
source share
2 answers

The Django dev server restarts it itself when changing Python code. This may not happen if you run it using the noreload option.

./manage.py runningerver --noreload

Another case where the server does not restart automatically is when django does not use file changes. For example, if you have a syntax error in your admin.py, django will not use it. And changing it will not restart the server. Keep in mind that if you use eclipse debugging, you will have to start django with noreload due to an error that does not restart the instance, but starts a new one.

+5
source

First configure the project as a django project in eclipse, if not already. (Right-click on the project and select PyDev โ†’ Install as Django Project).

Secondly, click the green launch button at the top and select "run configuration". Select the PyDev Django icon and click the new launch configuration button at the top. Enter the name of the project, (say testproject) and "$ {workspace_loc: testproject} / $ {DJANGO_MANAGE_LOCATION}" for the main module.

On the Arugments tab, enter "runningerver 0.0.0.0:8000 --noreload" if you want your server to be visible to machines outside of yours or "runningerver --noreload" if you want to access only on your computer and change working directory at $ {workspace_loc:}.

Click "Apply" and you must be configured to proceed!

Here's what it should look like when running inside eclipse: enter image description here

+3
source

All Articles