Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I slow down Django

Tags:

http

django

Simple question really

./manage.py runserver

Can I slow down localhost:8000 on my development machine so I can simulate file uploads and work on the look and feel of ajax uploading?

like image 236
Robert Johnstone Avatar asked Apr 24 '12 13:04

Robert Johnstone


People also ask

Does Django slow?

Django is not slow. Instagram was built on it, and all these years later they're still using the core request-response handlers.

Why is Django fast?

Its Object-Relational Mapper (ORM): This is another powerful Django feature that enables developers to interact with the database in a 'Python-like' style. This, again, helps developers accelerate the web development process, especially if they don't have a strong understanding of database languages like SQL.


2 Answers

depending on where you want to simulate such you could simply sleep?

from time import sleep
sleep(500)
like image 127
Hedde van der Heide Avatar answered Oct 08 '22 11:10

Hedde van der Heide


On osx or freebds, you can use ipfw to limit bandwidth on specific ports:

  sudo ipfw pipe 1 config bw 1Bytes/s delay 100ms
  sudo ipfw add 1 pipe 1 src-port 8000

Do not forget to delete it when you do not need it anymore:

sudo ipfw delete 1

Credit: jaguarcy

For osx there is also free app that will allow this:

http://slowyapp.com/

like image 42
bmihelac Avatar answered Oct 08 '22 13:10

bmihelac