Django restart server or httpd
Asked Answered
M

5

7

In django framework,When there are changes in urls.py or model.py or views.py .We would restart httpd.

But as the documentation says we could restart runserver to get the latest changes.

Which is the best efficient way for doing the above

Ment answered 18/9, 2010 at 17:36 Comment(0)
I
6

runserver.py restarts automatically every time you modify any .py file, but when you are using apache you have to restart the proccess manually.

Iosep answered 18/9, 2010 at 18:12 Comment(0)
B
5

touch your_project_name.wsgi and save without any change. It will change data modify and django will automatically reloading code.

Benighted answered 10/7, 2013 at 12:48 Comment(0)
G
1

runserver refers to the development server that is distributed with Django. Restarting this one or your httpd are the same thing, in both cases you restart the webserver. If you're using apache, you are not using the development server that is startet by runserver.py.

Granduncle answered 18/9, 2010 at 17:47 Comment(0)
V
1

Type fg in terminal to take job front and then type Ctr+c to stop server and then run

Python manage.py runserver 
Vanettavang answered 22/12, 2014 at 6:54 Comment(0)
M
0

For the development server, I added this very convenient function. Obviously, you should never leave this in prod.

from _thread import interrupt_main
def shutdown(_):
    # Clean up and then...
    interrupt_main()
    return redirect("/")

_thread.interrupt_main() simulates a KeyboardInterrupt (SIGINT).

Mccaffrey answered 30/1, 2024 at 4:28 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.