11

I'm creating a web app with Django. Since I'm very familiar with Apache I setup my development environment to have Django run through Apache using mod_wsgi. The only annoyance I have with this is that I have to restart Apache everytime I change my code. Is there a way around this?

joshwbrick
  • 5,882
  • 9
  • 48
  • 72
  • I have a fastcgi setup, and I've found that `touch`ing the index.fcgi file helps; e.g. `touch public_html/sitename/index.fcgi` . I'm assuming there's a similar file that you can `touch` in wsgi. – Shashank Agarwal Jun 01 '13 at 04:26

2 Answers2

15

mod_wsgi is great for production but I think the included server is better for development.

Anyway you should read this about automatic reloading of source code.

Desintegr
  • 6,992
  • 1
  • 22
  • 17
  • 5
    And for a Django slant on it, also read 'http://blog.dscpl.com.au/2008/12/using-modwsgi-when-developing-django.html' and 'http://blog.dscpl.com.au/2009/02/source-code-reloading-with-modwsgi-on.html'. – Graham Dumpleton Feb 28 '10 at 23:08
  • @GrahamDumpleton, looks like your links are busted. – mlissner May 08 '12 at 06:29
  • 2
    Remove the quote at the end of the URL. SO has screwed up when picking out the URL. – Graham Dumpleton May 08 '12 at 11:36
  • 2
    (Corrected links): [Source code reloading with mod_wsgi on Windows](http://blog.dscpl.com.au/2009/02/source-code-reloading-with-modwsgi-on.html) and [Using mod_wsgi when developing Django sites](http://blog.dscpl.com.au/2008/12/using-modwsgi-when-developing-django.html). – David Cain Jan 29 '13 at 05:11
-4

I feel like this is really just one of those things most people deal with. It's really not that big of a deal. I made a bash script to make this as easy as possible. I name it 'ra' (reload apache) so it's short and quick. The following works for most apache installs (on UNIX-based systems):

#!/bin/bash
sudo /etc/init.d/apache2 reload

You could probably use some kind of tool to bind this to a key shortcut/foot pedeal/cron.

b3ng0
  • 595
  • 4
  • 6
  • You could also do an alias that calls the same thing – Eddie Monge Jr Nov 14 '11 at 19:38
  • 1
    I think that should be a comment, not a response, because it is a non-solution to the problem. You could avoid some down-voting that way as well while still getting the message across. – Teekin Jul 16 '12 at 11:22