Configurazione del server di sviluppo uscita Django
Domanda
E 'possibile configurare l'uscita dal server di sviluppo Django per visualizzare l'indirizzo IP del client che effettua la richiesta?
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:
- Si consideri Gunicorn come server dev: http://gunicorn.org/ (orginNell)
- 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)
- Utilizza un server reale (Harro)
- Scrivi alcuni middleware per accedere a un file (Harro)
- Si consiglia di sostituire il built-in server con django-devserver: http://github.com/dcramer / django-devserver (mikeshantz)
- Mi piace cherrypy con django: http://www.cherrypy.org/ (John M)
- Cherokee è molto buona: http://www.cherokee-project.com/ (John M)
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow