---
title: "Bagaimana memasang Django pada WIndows"
version: 3.2
locale: id
source: https://docs.djangoproject.com/id/3.2/howto/windows/
canonical: https://djangodocs.dev/id/3.2/howto/windows/
---
# Bagaimana memasang Django pada WIndows

This document will guide you through installing Python 3.8 and Django on
Windows. It also provides instructions for setting up a virtual environment,
which makes it easier to work on Python projects. This is meant as a beginner's
guide for users working on Django projects and does not reflect how Django
should be installed when developing patches for Django itself.

The steps in this guide have been tested with Windows 10. In other
versions, the steps would be similar. You will need to be familiar with using
the Windows command prompt.

## Pasang Phyton

Django is a Python web framework, thus requiring Python to be installed on your
machine. At the time of writing, Python 3.8 is the latest version.

To install Python on your machine go to <https://www.python.org/downloads/>. The
website should offer you a download button for the latest Python version.
Download the executable installer and run it. Check the boxes next to "Install
launcher for all users (recommended)" then click "Install Now".

Setelah pemasangan, buka command prompt dan periksa bahwa versi Python cocok dengan versi anda pasang dengan menjalankan:

```doscon
...\> py --version
```

> **See also**
>
> Untuk rincian lebih,lihat dokumentasi [Using Python on Windows](https://docs.python.org/3/using/windows.html).

## Tentang `pip`

[pip](https://pypi.org/project/pip/) is a package manager for Python and is included by default with the
Python installer. It helps to install and uninstall Python packages
(such as Django!). For the rest of the installation, we'll use `pip` to
install Python packages from the command line.

## Menyetel lingkungan maya

It is best practice to provide a dedicated environment for each Django project
you create. There are many options to manage environments and packages within
the Python ecosystem, some of which are recommended in the [Python
documentation](https://packaging.python.org/guides/tool-recommendations/).
Python itself comes with [venv](https://docs.python.org/3/tutorial/venv.html) for managing
environments which we will use for this guide.

To create a virtual environment for your project, open a new command prompt,
navigate to the folder where you want to create your project and then enter the
following:

```doscon
...\> py -m venv project-name
```

This will create a folder called 'project-name' if it does not already exist
and setup the virtual environment. To activate the environment, run:

```doscon
...\> project-name\Scripts\activate.bat
```

The virtual environment will be activated and you'll see "(project-name)" next
to the command prompt to designate that. Each time you start a new command
prompt, you'll need to activate the environment again.

## Pasang Django

Django dapat dipasang dengan mudah menggunakan `pip` dalam lingkungan maya anda.

Di command prompt, pastikan lignkungan maya anda aktif, dan jalankan perintah berikut:

```doscon
...\> py -m pip install Django
```

Ini akan mengunduh dan memasang terbitan Django terakhir.

Setelah pemasangan lengkap, anda dapat memeriksa pemasangan Django anda dengan menjalankan `django-admin --version` di command prompt.

Lihat [Dapatkan basisdata anda berjalan](/id/3.2/topics/install/#database-installation) untuk informasi pada pemasangan basisdata dengan Django.

## Keluaran terminal bewarna

> **New in Django 3.2**

A quality-of-life feature adds colored (rather than monochrome) output to the
terminal. In modern terminals this should work for both CMD and PowerShell. If
for some reason this needs to be disabled, set the environmental variable
[`DJANGO_COLORS`](/id/3.2/ref/django-admin/#envvar-DJANGO_COLORS) to `nocolor`.

On older Windows versions, or legacy terminals, [colorama](https://pypi.org/project/colorama/) must be installed to
enable syntax coloring:

```doscon
...\> py -m pip install colorama
```

Lihat [Pewarnaan sintaksis](/id/3.2/ref/django-admin/#syntax-coloring) untuk informasi lebih pada pengaturan warna.

## Kesalahan umum

- Jika `django-admin` hanya menampilkan teks bantuan tidak perduli argumen apa yang diberikan, ada kemungkinan masalah dengan berkas terkait di Windows. Periksa jika ada lagi dari satu kumpulan lingkungan variabel untuk menjalankan tulisan Python dalam  `PATH`. Ini biasanya muncul ketika ada lebih dari satu versi Python terpasang.
- Jika Anda terhubung ke internet menggunakan proksi, mungkin akan muncul masalah ketika menjalankan `py -m pip install Django`. Atur variabel environment untuk konfigurasi proksi dalam terminal sebagai berikut:

  ```doscon
  ...\> set http_proxy=http://username:password@proxyserver:proxyport
  ...\> set https_proxy=https://username:password@proxyserver:proxyport
  ```
- In general, Django assumes that `UTF-8` encoding is used for I/O. This may
  cause problems if your system is set to use a different encoding. Recent
  versions of Python allow setting the [`PYTHONUTF8`](https://docs.python.org/3/using/cmdline.html#envvar-PYTHONUTF8) environment
  variable in order to force a `UTF-8` encoding. Windows 10 also provides a
  system-wide setting by checking `Use Unicode UTF-8 for worldwide language
  support` in Language ‣ Administrative Language Settings
  ‣ Change system locale in system settings.
