Domanda

E 'possibile configurare l'uscita dal server di sviluppo Django per visualizzare l'indirizzo IP del client che effettua la richiesta?

È stato utile?

Soluzione

Questo nella nostra lista per "mods standard" a nuove release Django. Per Django 1.2.1, in Django / core / server / basehttp.py, linea 614, modificare:

   msg = "[%s] %s\n" % (self.log_date_time_string(), format % args)

a

   msg = "[%s] %s %s\n" % (self.log_date_time_string(),
                       self.client_address[0], format % args)

Altri suggerimenti

Altre risposte che ho avuto mi ha suggerito:

  1. Si consideri Gunicorn come server dev: http://gunicorn.org/ (orginNell)
  2. Considerare l'utilizzo di ereditarietà di classe su basehttp.py per creare un nuovo comando la gestione ed evitare scherzi con il codice di base (orginNell)
  3. Utilizza un server reale (Harro)
  4. Scrivi alcuni middleware per accedere a un file (Harro)
  5. Si consiglia di sostituire il built-in server con django-devserver: http://github.com/dcramer / django-devserver (mikeshantz)
  6. Mi piace cherrypy con django: http://www.cherrypy.org/ (John M)
  7. Cherokee è molto buona: http://www.cherokee-project.com/ (John M)
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top