Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django + apache & mod_wsgi: having to restart apache after changes

I configured my development server this way:

Ubuntu, Apache, mod_wsgi, Python 2.6

I work on the server from another computer connected to it.

Most of the times the changes don't affect the application unless I restart Apache. In some cases the changes take effect without restarting the webserver, but after let's say 3 or 4 page loads the application might behave like it used to behave previous to the changes.

Until now I just reloaded everytime apache as I have the development server here with me, but HELL after a while got so annoying. How can I avoid this?

I can't work with the development server as I need an environment that is as close as possible as the production one.

Thanks

like image 718
nemesisdesign Avatar asked Nov 17 '10 15:11

nemesisdesign


People also ask

Does Django use Apache?

Django will work with any version of Apache which supports mod_wsgi. The official mod_wsgi documentation is your source for all the details about how to use mod_wsgi. You'll probably want to start with the installation and configuration documentation.

What is Apache in Django?

Django Configuration with Apache Web ServerDjango uses its built-in development server to run the web application. To start this server, we can use python manage.py runserver command. This command starts the server which runs on port 8000 and can be accessed at browser by entering localhost:8000.

Which web server is best for Django?

Gunicorn is the recommended HTTP server for use with Django on Heroku (as referenced in the Procfile above). It is a pure-Python HTTP server for WSGI applications that can run multiple Python concurrent processes within a single dyno (see Deploying Python applications with Gunicorn for more information).


1 Answers

My suggestion is that you run the application in daemon mode. This way you won't be required to restart apache, just touch my_handler.wsgi and the daemon will know to restart the app. The apache httpd will not be only yours (in production) so it is fair not to restart it on every update.

like image 110
vonPetrushev Avatar answered Sep 20 '22 04:09

vonPetrushev