---
title: "Bagaimana memasang Django"
version: 4.2
locale: id
source: https://docs.djangoproject.com/id/4.2/topics/install/
canonical: https://djangodocs.dev/id/4.2/topics/install/
---
# Bagaimana memasang Django

Dokumen ini akan membangunkan anda dan berjalan dengan Django.

## Pasang Phyton

Django is a Python web framework. See [Versi Phyton apa dapat Saya gunakan dengan Django?](/id/4.2/faq/install/#faq-python-version-support) for
details.

Dapatkan versi terakhir dari Python pada <https://www.python.org/downloads/> atau dengan pengelola paket sistem operasi anda.

> **Phyton di Windows**
>
> Jika anda hanya memulai dengan Django dan menggunakan Windows, anda mungkin menemukan [Bagaimana memasang Django pada WIndows](/id/4.2/howto/windows/) berguna.

## Pasang Apache dan `mod_wsgi`

Jika anda hanya ingin melakukan percobaan dengan Django, lewati bagian selanjutnya; Django menyertakan peladen jaringan ringan anda dapat gunakan untuk percobaan, jadi anda tidak butuh menyetel Apache sampai anda siap menyebarkan Django dalam produksi.

If you want to use Django on a production site, use [Apache](https://httpd.apache.org/) with
[mod\_wsgi](https://modwsgi.readthedocs.io/en/develop/). mod\_wsgi operates in one of two modes: embedded
mode or daemon mode. In embedded mode, mod\_wsgi 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. In daemon mode, mod\_wsgi spawns
an independent daemon process that handles requests. The daemon
process can run as a different user than the web server, possibly
leading to improved security. The daemon process can be restarted
without restarting the entire Apache web server, possibly making
refreshing your codebase more seamless. Consult the mod\_wsgi
documentation to determine which mode is right for your setup. Make
sure you have Apache installed with the mod\_wsgi module activated.
Django will work with any version of Apache that supports mod\_wsgi.

Lihat How to use Django with mod\_wsgi 1 untuk informasi bagaimana mengkonfigurasi mode\_wsgi sekali anda telah memasang itu.

Jika anda tidak dapat menggunakan mod\_wsgi untuk beberapa alasan, jangan takut: Django mendukung banyak pilihan penyebaran lain. Satu adalah [uWSGI](/id/4.2/howto/deployment/wsgi/uwsgi/); itu bekerja sangat baik dengan [nginx](https://nginx.org/). Selain itu, Django mengikuti spesifikasi WSGI ([**PEP 3333**](https://peps.python.org/pep-3333/)), yang mengizinkannya untuk berjalan pada seragam serambi peladen.

## Dapatkan basisdata anda berjalan

If you plan to use Django's database API functionality, you'll need to make
sure a database server is running. Django supports many different database
servers and is officially supported with [PostgreSQL](https://www.postgresql.org/), [MariaDB](https://mariadb.org/), [MySQL](https://www.mysql.com/), [Oracle](https://www.oracle.com/)
and [SQLite](https://www.sqlite.org/).

If you are developing a small project or something you don't plan to deploy in
a production environment, SQLite is generally the best option as it doesn't
require running a separate server. However, SQLite has many differences from
other databases, so if you are working on something substantial, it's
recommended to develop with the same database that you plan on using in
production.

Sebagai tambahan ke basisdata didukung resmi, ada backends provided by 3rd parties 1 yang mengizinkan anda menggunakan basisdata lain dengan Django.

Sebagai tambahan ke backend basisdata, anda akan butuh memastikan pengikatan basisdata Python anda terpasang.

- If you're using PostgreSQL, you'll need the [psycopg](https://www.psycopg.org/psycopg3/) or [psycopg2](https://www.psycopg.org/)
  package. Refer to the [PostgreSQL notes](/id/4.2/ref/databases/#postgresql-notes) for further
  details.
- If you're using MySQL or MariaDB, you'll need a [DB API driver](/id/4.2/ref/databases/#mysql-db-api-drivers) like `mysqlclient`. See [notes for the MySQL
  backend](/id/4.2/ref/databases/#mysql-notes) for details.
- Jika anda sedang menggunakan SQLite anda mungkin ingin membaca SQLite backend notes 1.
- Jika anda sedang menggunakan Oracle, anda akan butuh salinan dari [cx\_Oracle](https://oracle.github.io/python-cx_Oracle/), tetapi harap membaca notes for the Oracle backend 1 untuk rincian mengenai versi didukung dari kedua Oracle dan `cx_Oracle`.
- Jika anda sedang menggunakan backend pihak ke3 tidak resmi, harap konsultasikan dokumentasi disediakan untuk persyaratan tambahan apapun.

Jika anda berencana untuk menggunakan perintah `manage.py migrate` Django untuk secara otomatis membuat tabel basis data untuk model anda (setelah pertama memasang Django dan membuat proyek), anda harus memastikan bahwa Django memiliki izin untuk membuat dan mengubah tabel di database yang anda gunakan; jika anda berencana untuk membuat tabel secara manual, anda dapat memberikan izin Django `SELECT`, `INSERT`, `UPDATE` dan `DELETE`. Setelah membuat pengguna basis data dengan izin ini, anda akan menentukan rinciannya di berkas pengaturan proyek anda , lihat [`DATABASES`](/id/4.2/ref/settings/#std-setting-DATABASES) untuk rinciannya.

Jika anda sedang menggunakan testing framework1 Django untuk mencoba permintaan basisdata, Django akan butuh perizinan untuk membuat basisdata percobaan.

## Pasang kode Django

Installation instructions are slightly different depending on whether you're
installing a distribution-specific package, downloading the latest official
release, or fetching the latest development version.

### Memasang terbitan resmi dengan `pip`

Ini adalah cara yang dianjurkan untuk memasang Django.

1. Pasang [pip](https://pip.pypa.io/). Paling mudah adalah menggunakan [standalone pip installer](https://pip.pypa.io/en/latest/installation/). Jika penyaluran anda sudah mempunyai `pip` terpasang, anda mungkin butuh memperbaharui jika itu sudah usang. Jika itu sudah usang, anda akan tahu karena pemasangan tidak akan bekerja.
2. Take a look at [venv](https://docs.python.org/3/tutorial/venv.html). This tool provides
   isolated Python environments, which are more practical than installing
   packages systemwide. It also allows installing packages without
   administrator privileges. The [contributing tutorial](/id/4.2/intro/contributing/) walks through how to create a virtual environment.
3. After you've created and activated a virtual environment, enter the command:

   ```console
   $ python -m pip install Django
   ```

   *Windows*

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

### Memasang paket penyebaran-tertentu

Check the [distribution specific notes](/id/4.2/misc/distributions/) to see if
your platform/distribution provides official Django packages/installers.
Distribution-provided packages will typically allow for automatic installation
of dependencies and supported upgrade paths; however, these packages will rarely
contain the latest release of Django.

### Memasang versi pengembangan

> **Melacak pengembangan Django**
>
> If you decide to use the latest development version of Django,
> you'll want to pay close attention to [the development timeline](https://code.djangoproject.com/timeline),
> and you'll want to keep an eye on the [release notes for the
> upcoming release](/id/4.2/releases/#development-release-notes). This will help you stay
> on top of any new features you might want to use, as well as any changes
> you'll need to make to your code when updating your copy of Django.
> (For stable releases, any necessary changes are documented in the
> release notes.)

If you'd like to be able to update your Django code occasionally with the
latest bug fixes and improvements, follow these instructions:

1. Pastikan anda mempunyai [Git](https://git-scm.com/) terpasang dan anda dapat menjalankan perintah nya dari shell. (masukkan `git help` pada shell prompt untuk mencoba ini.)
2. Periksa cabang pengembangan Django seperti itu:

   ```console
   $ git clone https://github.com/django/django.git
   ```

   *Windows*

   ```doscon
   ...\> git clone https://github.com/django/django.git
   ```

   Ini akan membuat sebuah direktori `django` dalam direktori anda saat ini.
3. Make sure that the Python interpreter can load Django's code. The most
   convenient way to do this is to use a virtual environment and [pip](https://pip.pypa.io/). The
   [contributing tutorial](/id/4.2/intro/contributing/) walks through how to
   create a virtual environment.
4. After setting up and activating the virtual environment, run the following
   command:

   ```console
   $ python -m pip install -e django/
   ```

   *Windows*

   ```doscon
   ...\> py -m pip install -e django\
   ```

   This will make Django's code importable, and will also make the
   `django-admin` utility command available. In other words, you're all
   set!

When you want to update your copy of the Django source code, run the command
`git pull` from within the `django` directory. When you do this, Git will
download any changes.
