Reputation: 6997
Am currently developing a website that consists of mutliple sites in the same project therefore I have several settings.py files each with different SITE_ID. As am developing, everytime I have to go through the 8 settings files and start up the runserver one by one to do full testing and navigate between the sites.
Is there a way for me to run them all at once? I tried to do a command line utility for that but the management.call_command interface does not allow to fire off a process in the background.
Any ideas how can i build something?
Upvotes: 0
Views: 55
Reputation: 28856
You can't background it directly through the python interface, but you can simply run one process per site. For example, in bash, something like
for site in settings_{a,b,c,d}; do
python manage.py runserver --settings $site &
done
If you want to run it in python, try the subprocess
module, or you could run management.call_command
through a multiprocessing.Pool
.
You'll want to run these on different ports as well, as Variant mentioned.
Upvotes: 3
Reputation: 17385
You can run the multiple sites each in a different port. to do this you can start the sites up like this:
/manage.py runserver portnum
where you can change the port number (i.e. 8002, 8003, etc...) for each site
Upvotes: 1