{{{ #!rst .. ===================== How to install Django ===================== .. sidebar:: Come installare Django :subtitle: traduzione in lingua italiana. Documento originale: `How to install Django`_ Traduzione: paolo `` Aggiornato alla revisione: 2930 .. _How to install Django: http://www.djangoproject.com/documentation/install/ .. contents:: **Contenuti del capitolo** ====================== Come installare Django ====================== .. This document will get you up and running with Django. Questo documento ti renderà operativo con Django. .. Install Python ============== Installare Python ================= .. Being a Python Web framework, Django requires Python. Django è un framework Web scritto in Python, perciò richiede Python. .. It works with any Python version 2.3 and higher. E' in grado di funzionare con qualsiasi versione di Python dalla 2.3 in poi. .. Get Python at www.python.org. If you're running Linux or Mac OS X, you probably already have it installed. Puoi ottenere Python dal sito www.python.org. Se stai usando Linux o Mac OS X, probabilmente lo trovi già installato. .. Install Apache and mod_python ============================= Installare Apache e mod_python ============================== .. If you just want to experiment with Django, skip this step. Django comes with its own Web server for development purposes. Se vuoi soltanto fare qualche esperimento con Django puoi tralasciare questa parte di installazione. Django infatti viene fornito con un proprio Web server adatto a funzionare in ambienti di sviluppo e test. .. If you want to use Django on a production site, use Apache with `mod_python`_. mod_python is similar to mod_perl -- it embeds Python within Apache and loads Python code into memory when the server starts. Code stays in memory throughout the life of an Apache process, which leads to significant performance gains over other server arrangements. Make sure you have Apache installed, with the mod_python module activated. Django requires Apache 2.x and mod_python 3.x. Nel caso in cui sia previsto l'utilizzo in ambienti di produzione usa Apache assieme a `mod_python`_. mod_python è simile a mod_perl -- integra Python all'interno di Apache e carica il codice in memoria quando il server viene avviato. Il codice risiede in memoria per tutta la durata di un processo di Apache, e ciò offre - rispetto ad altre configurazioni - un guadagno di prestazioni significativo. Assicurati che Apache sia installato e che mod_python sia attivo. Django richiede Apache 2.x e mod_python 3.x. .. See `How to use Django with mod_python`_ for information on how to configure mod_python once you have it installed. Per informazioni su come configurare mod_python dopo averlo installato consulta `Come usare Django con mod_python`_. .. If you can't use mod_python for some reason, fear not: Django follows the WSGI_ spec, which allows it to run on a variety of server platforms. See the `server-arrangements wiki page`_ for specific installation instructions for each platform. Se per qualche ragione non puoi usare mod_python, non temere: Django segue le specifiche WSGI_, perciò può funzionare assieme ad altre piattaforme server. Vedi la `pagina del wiki sulle configurazioni dei server`_. .. _Apache: http://httpd.apache.org/ .. _mod_python: http://www.modpython.org/ .. _WSGI: http://www.python.org/peps/pep-0333.html .. _Come usare Django con mod_python: http://www.djangoproject.com/documentation/modpython/ .. _pagina del wiki sulle configurazioni dei server: http://code.djangoproject.com/wiki/ServerArrangements .. Get your database running ========================= Metti in funzione il database ============================= .. If you plan to use Django's database API functionality, you'll need to make sure a database server is running. Django works with PostgreSQL_ (recommended), MySQL_ and SQLite_. Se pensi di usare le funzionalità messe a disposizione dalle API di Django per i database, devi essere sicuro che sia in funzione un database server. Django funziona con PostgreSQL_ (soluzione raccomandata), MySQL_ e SQLite_. .. Additionally, you'll need to make sure your Python database bindings are installed. * If you're using PostgreSQL, you'll need the psycopg_ package (version 1.1 -- not version 1.0 or version 2, which is still in beta). If you're on Windows, check out the unofficial `compiled Windows version`_. * If you're using MySQL, you'll need MySQLdb_. * If you're using SQLite, you'll need pysqlite_. Use version 2.0.3 or higher. Devi anche accertarti che i binding Python per l'interfacciamento ai database siano installati. * Se usi PostgreSQL ti serve il pacchetto psycopg_ (la versione 1.1 -- non la 2.0 che ancora non è considerata stabile). Se usi Windows procurati la `versione compilata`_. * Se usi MySQL ti serve MySQLdb_. * Se usi SQLite ti serve la versione 2.0.3 o successiva di pysqlite_. .. _PostgreSQL: http://www.postgresql.org/ .. _MySQL: http://www.mysql.com/ .. _Django's ticket system: http://code.djangoproject.com/report/1 .. _psycopg: http://initd.org/projects/psycopg1 .. _versione compilata: http://stickpeople.com/projects/python/win-psycopg/ .. _MySQLdb: http://sourceforge.net/projects/mysql-python .. _SQLite: http://www.sqlite.org/ .. _pysqlite: http://initd.org/tracker/pysqlite .. Install the Django code ======================= Installare il codice di Django ============================== .. Installation instructions are slightly different depending on whether you're using the latest official version or the latest development version. Le istruzioni di installazione sono leggermente differenti se usi l'ultima versione ufficiale o l'ultima versione in sviluppo. .. It's easy either way. In un caso o nell'altro la procedura è semplice. .. Installing the official version ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Installare la versione ufficiale ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. 1. Download Django-0.91.tar.gz from our `download page`_. 2. ``tar xzvf Django-0.91.tar.gz`` 3. ``cd Django-0.91`` 4. ``sudo python setup.py install`` 1. Scarica Django-0.91.tar.gz dalla `pagina dei download`_. 2. ``tar xzvf Django-0.91.tar.gz`` 3. ``cd Django-0.91`` 4. ``sudo python setup.py install`` .. Note that the last command will automatically download and install setuptools_ if you don't already have it installed. This requires a working Internet connection. Nota che, se setuptools_ non fa ancora parte del tuo setup, l'ultimo comando dell'elenco lo scaricherà e lo installerà automaticamente. Perciò ti servirà una connessione ad Internet funzionante. .. This will install Django in your Python installation's ``site-packages`` directory. In questo modo Django verrà posizionato nella directory ``site-packages`` dell'installazione Python. .. .. note:: Due to recent backwards-incompatible changes, it is strongly recommended that you use the development version (below) for any new applications or if you are just starting to work with Django. The 0.91 release is a dead-end branch that is primarily of use for supporting legacy Django applications. .. note:: A causa di recenti modifiche, sono state introdotte alcune incompatibilità con le precedenti versioni di Django. E' fortemente raccomandato l'utilizzo della versione di sviluppo (vedi oltre) se stai comincindo lo sviluppo di qualsiasi nuova applicazione o se stai muovendo i primi passi con Django. La versione 0.91 non sarà più mantenuta, ed il suo scopo primario è quello di supportare applicazioni Django preesistenti. .. _setuptools: http://peak.telecommunity.com/DevCenter/setuptools .. Installing the development version ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Installare la versione di sviluppo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. 1. Make sure you have Subversion_ installed. 2. ``svn co http://code.djangoproject.com/svn/django/trunk/ django_src`` 3. Symlink ``django_src/django`` so that ``django`` is within your Python ``site-packages`` directory: ``ln -s `pwd`/django_src/django /usr/lib/python2.3/site-packages/django`` (In the above line, change ``python2.3`` to match your current Python version.) 1. Assicurati che Subversion_ sia installato. 2. ``svn co http://code.djangoproject.com/svn/django/trunk/ django_src`` 3. Crea un link simbolico a ``django_src/django`` in modo che ``django`` sia nella directory ``site-packages`` dell'installazione Python: ``ln -s `pwd`/django_src/django /usr/lib/python2.3/site-packages/django`` (Nella riga sopra modifica ``python2.3`` facendolo coincidere con la versione di Python che stai utilizzando correntemente.) .. You don't have to run ``python setup.py install``. Non devi eseguire ``python setup.py install``. .. When you want to update your code, just run the command ``svn update`` from within the ``django_src`` directory. Quando vuoi aggiornare il codice, scrivi semplicemente il comando ``svn update`` stando nella directory ``django_src``. .. .. _`download page`: http://www.djangoproject.com/download/ .. _Subversion: http://subversion.tigris.org/ .. _`pagina dei download`: http://www.djangoproject.com/download/ .. _Subversion: http://subversion.tigris.org/ }}}