{"title":"Come installare Django su Windows","version":"5.2","locale":"it","docname":"howto/windows","url":"/it/5.2/howto/windows/","canonical":"https://djangodocs.dev/it/5.2/howto/windows/","summary":"This document will guide you through installing Python 3.14 and Django on Windows. It also provides instructions for setting up a virtual environment, which makes…","html":"<h1>Come installare Django su Windows<a class=\"heading-anchor\" href=\"#how-to-install-django-on-windows\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p>This document will guide you through installing Python 3.14 and Django on\nWindows. It also provides instructions for setting up a virtual environment,\nwhich makes it easier to work on Python projects. This is meant as a beginner’s\nguide for users working on Django projects and does not reflect how Django\nshould be installed when developing changes for Django itself.</p>\n<p>I passaggi in questa guida sono stati testati su Windows 10. Nelle altre versioni, i passaggi dovrebbero essere simili. Potrebbe aiutare una conoscenza del prompt di comandi di Windows.</p>\n<section id=\"install-python\">\n<span id=\"install-python-windows\"></span><h2>Installa Python<a class=\"heading-anchor\" href=\"#install-python\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Django is a Python web framework, thus requiring Python to be installed on your\nmachine. At the time of writing, Python 3.14 is the latest version.</p>\n<p>Per installare Python sulla tua macchina vai a <a class=\"reference external\" href=\"https://www.python.org/downloads/\">https://www.python.org/downloads/</a>.  Il sito web dovrebbe offrire un pulsante download per l’ultima versione di Python. Scarica l’installer eseguibile e lancialo. Spunta il box vicino a «Install launcher for all users (recommended)» e poi clicca su «Install Now».</p>\n<p>After installation, open the command prompt and check that the Python version\nmatches the version you installed by executing:</p>\n<div class=\"code-block\" data-language=\"doscon\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Windows</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Windows code\"><code><span class=\"gp\">...\\&gt;</span> py --version\n</code></pre></div>\n<aside class=\"admonition-py-is-not-recognized-or-found admonition\">\n<p class=\"admonition-title\"><code class=\"docutils literal notranslate\"><span class=\"pre\">py</span></code> is not recognized or found</p>\n<p>Depending on how you’ve installed Python (such as via the Microsoft Store),\n<code class=\"docutils literal notranslate\"><span class=\"pre\">py</span></code> may not be available in the command prompt.</p>\n<p>You will then need to use <code class=\"docutils literal notranslate\"><span class=\"pre\">python</span></code> instead of <code class=\"docutils literal notranslate\"><span class=\"pre\">py</span></code> when entering\ncommands.</p>\n</aside>\n<aside class=\"admonition admonition-seealso\">\n<p class=\"admonition-title\">Vedi anche</p>\n<p>Per maggiori dettagli, vedere la documentazione <a class=\"reference external\" href=\"https://docs.python.org/3/using/windows.html\" title=\"(in Python v3.14)\"><span>Using Python on Windows</span></a>.</p>\n</aside>\n</section>\n<section id=\"about-pip\">\n<h2>Su <code class=\"docutils literal notranslate\"><span class=\"pre\">pip</span></code><a class=\"heading-anchor\" href=\"#about-pip\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p><a class=\"extlink-pypi reference external\" href=\"https://pypi.org/project/pip/\">pip</a> is a package manager for Python and is included by default with the\nPython installer. It helps to install and uninstall Python packages\n(such as Django!). For the rest of the installation, we’ll use <code class=\"docutils literal notranslate\"><span class=\"pre\">pip</span></code> to\ninstall Python packages from the command line.</p>\n</section>\n<section id=\"setting-up-a-virtual-environment\">\n<span id=\"virtualenvironment\"></span><h2>Impostazione di un ambiente virtuale<a class=\"heading-anchor\" href=\"#setting-up-a-virtual-environment\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>È buona norma fornire un ambiente dedicato per ogni progetto Django che crei. Ci sono molte opzioni per gestire ambienti e pacchetti all’interno dell’ecosistema Python, alcune delle quali sono consigliate nella <a class=\"reference external\" href=\"https://packaging.python.org/guides/tool-recommendations/\">Documentazione Python</a>. Python stesso viene fornito con <a class=\"reference external\" href=\"https://docs.python.org/3/tutorial/venv.html\" title=\"(in Python v3.14)\"><span class=\"xref std std-doc\">venv</span></a> per la gestione degli ambienti che useremo per questa guida.</p>\n<p>To create a virtual environment for your project, open a new command prompt,\nnavigate to the folder where you want to create your project and then enter the\nfollowing:</p>\n<div class=\"code-block\" data-language=\"doscon\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Windows</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Windows code\"><code><span class=\"gp\">...\\&gt;</span> py -m venv project-name\n</code></pre></div>\n<p>This will create a folder called “project-name” if it does not already exist\nand set up the virtual environment. To activate the environment, run:</p>\n<div class=\"code-block\" data-language=\"doscon\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Windows</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Windows code\"><code><span class=\"gp\">...\\&gt;</span> project-name\\Scripts\\activate.bat\n</code></pre></div>\n<p>L’ambiente virtuale verrà attivato e vedrai «(nome-progetto)» accanto al prompt dei comandi per designarlo. Ogni volta che avvii un nuovo prompt dei comandi, dovrai attivare nuovamente l’ambiente.</p>\n</section>\n<section id=\"install-django\">\n<h2>Installa Django<a class=\"heading-anchor\" href=\"#install-django\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Django puo essere installato utilizzando <code class=\"docutils literal notranslate\"><span class=\"pre\">pip</span></code> nel tuo ambiente virtuale.</p>\n<p>In the command prompt, ensure your virtual environment is active, and execute\nthe following command:</p>\n<div class=\"code-block\" data-language=\"doscon\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Windows</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Windows code\"><code><span class=\"gp\">...\\&gt;</span> py -m pip install Django\n</code></pre></div>\n<p>Questo scarichera e installera l’ultima versione di Django</p>\n<p>Dopo che l’installazione è stata completata, puoi verificare la tua installazione di Django eseguendo <code class=\"docutils literal notranslate\"><span class=\"pre\">django-admin</span> <span class=\"pre\">--version</span></code> nel prompt dei comandi.</p>\n<p>Vedere <a class=\"reference internal\" href=\"/it/5.2/topics/install/#database-installation\"><span class=\"std std-ref\">Get your database running</span></a> per informazioni sull’installazione del database con Django.</p>\n</section>\n<section id=\"colored-terminal-output\">\n<h2>Risultato colorato del terminale<a class=\"heading-anchor\" href=\"#colored-terminal-output\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Una funzione di qualità della vita aggiunge un output colorato (anziché monocromatico) al terminale. Nei terminali moderni questo dovrebbe funzionare sia per CMD che per PowerShell. Se per qualche motivo questo deve essere disabilitato, imposta la variabile ambientale <span class=\"target\" id=\"index-4\"></span><a class=\"reference internal\" href=\"/it/5.2/ref/django-admin/#envvar-DJANGO_COLORS\"><code class=\"xref std std-envvar docutils literal notranslate\"><span class=\"pre\">DJANGO_COLORS</span></code></a> su <code class=\"docutils literal notranslate\"><span class=\"pre\">nocolor</span></code>.</p>\n<p>On older Windows versions, or legacy terminals, <a class=\"extlink-pypi reference external\" href=\"https://pypi.org/project/colorama/\">colorama</a> 0.4.6+ must be\ninstalled to enable syntax coloring:</p>\n<div class=\"code-block\" data-language=\"doscon\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Windows</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Windows code\"><code><span class=\"gp\">...\\&gt;</span> py -m pip install <span class=\"s2\">&quot;colorama &gt;= 0.4.6&quot;</span>\n</code></pre></div>\n<p>Vedere <a class=\"reference internal\" href=\"/it/5.2/ref/django-admin/#syntax-coloring\"><span class=\"std std-ref\">Syntax coloring</span></a> per ulteriori informazioni sulle impostazioni del colore.</p>\n</section>\n<section id=\"common-pitfalls\">\n<h2>Insidie comuni<a class=\"heading-anchor\" href=\"#common-pitfalls\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<ul>\n<li><p>Se <code class=\"docutils literal notranslate\"><span class=\"pre\">django-admin</span></code> mostra solo un testo di aiuto, non importa che argomenti gli si diano, probabilmente c’è un problema di associazione di file in Windows. Controlla se c’è più di una variabile di ambiente impostata per lanciare gli script Python in <code class=\"docutils literal notranslate\"><span class=\"pre\">PATH</span></code>. Questo generalmente accade quando c’è più di una versione di Python installata.</p></li>\n<li><p>If you are connecting to the internet behind a proxy, there might be problems\nin running the command <code class=\"docutils literal notranslate\"><span class=\"pre\">py</span> <span class=\"pre\">-m</span> <span class=\"pre\">pip</span> <span class=\"pre\">install</span> <span class=\"pre\">Django</span></code>. Set the environment\nvariables for proxy configuration in the command prompt as follows:</p>\n<div class=\"code-block\" data-language=\"doscon\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Windows</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Windows code\"><code><span class=\"gp\">...\\&gt;</span> <span class=\"k\">set</span> <span class=\"nv\">http_proxy</span><span class=\"p\">=</span>http://username:password@proxyserver:proxyport\n<span class=\"gp\">...\\&gt;</span> <span class=\"k\">set</span> <span class=\"nv\">https_proxy</span><span class=\"p\">=</span>https://username:password@proxyserver:proxyport\n</code></pre></div>\n</li>\n<li><p>In generale, Django assume che per l’I/O venga usato l’encoding <code class=\"docutils literal notranslate\"><span class=\"pre\">UTF-8</span></code>. Questo può causare problemi se il tuo sistema è impostato per usare un encoding differente. Versioni recenti di Python permettono di impostare la variabile di ambiente <span class=\"target\" id=\"index-5\"></span><a class=\"reference external\" href=\"https://docs.python.org/3/using/cmdline.html#envvar-PYTHONUTF8\" title=\"(in Python v3.14)\"><code class=\"xref std std-envvar docutils literal notranslate\"><span class=\"pre\">PYTHONUTF8</span></code></a> per forzare l’encoding <code class=\"docutils literal notranslate\"><span class=\"pre\">UTF-8</span></code>. Windows 10 offre una impostazione a livello di sistema, spuntando <code class=\"docutils literal notranslate\"><span class=\"pre\">Usa</span> <span class=\"pre\">Unicode</span> <span class=\"pre\">UTF-8</span> <span class=\"pre\">per</span> <span class=\"pre\">il</span> <span class=\"pre\">supporto</span> <span class=\"pre\">alle</span> <span class=\"pre\">lingue</span> <span class=\"pre\">di</span> <span class=\"pre\">tutto</span> <span class=\"pre\">il</span> <span class=\"pre\">mondo</span></code> in <span class=\"menuselection\">Lingua ‣ Impostazioni di Amministrazione della Lingua ‣ Cambia il locale del sistema</span> nelle impostazioni di sistema.</p></li>\n</ul>\n</section>","rootId":"how-to-install-django-on-windows","toc":[{"title":"Installa Python","anchor":"install-python","children":[]},{"title":"Su pip","anchor":"about-pip","children":[]},{"title":"Impostazione di un ambiente virtuale","anchor":"setting-up-a-virtual-environment","children":[]},{"title":"Installa Django","anchor":"install-django","children":[]},{"title":"Risultato colorato del terminale","anchor":"colored-terminal-output","children":[]},{"title":"Insidie comuni","anchor":"common-pitfalls","children":[]}],"breadcrumbs":[{"docname":"howto/index","title":"How-to guides","url":"/it/5.2/howto/"}],"prev":{"docname":"howto/upgrade-version","title":"Come aggiornare Django ad una nuova versione","url":"/it/5.2/howto/upgrade-version/"},"next":{"docname":"howto/deployment/index","title":"Come distribuire Django","url":"/it/5.2/howto/deployment/"},"formats":{"html":"/it/5.2/howto/windows/","markdown":"/it/5.2/howto/windows.md","json":"/it/5.2/howto/windows.json"},"source":"https://github.com/django/django/blob/stable/5.2.x/docs/howto/windows.txt","official":"https://docs.djangoproject.com/it/5.2/howto/windows/","inVersions":["6.1","6.0","5.2","5.1","5.0","4.2","4.1","4.0","3.2"],"inLocales":["en","sv","zh-hans","ga","fr","ja","id","it","pt-br","ko","es","el","pl"]}