{"title":"Bagaimana memasang Django","version":"6.0","locale":"id","docname":"topics/install","url":"/id/6.0/topics/install/","canonical":"https://djangodocs.dev/id/6.0/topics/install/","summary":"Dokumen ini akan membangunkan anda dan berjalan dengan Django. Pasang Phyton Link to this heading # Django is a Python web framework. See Versi Phyton apa dapat…","html":"<h1>Bagaimana memasang Django<a class=\"heading-anchor\" href=\"#how-to-install-django\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p>Dokumen ini akan membangunkan anda dan berjalan dengan Django.</p>\n<section id=\"install-python\">\n<h2>Pasang Phyton<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. See <a class=\"reference internal\" href=\"/id/6.0/faq/install/#faq-python-version-support\"><span class=\"std std-ref\">Versi Phyton apa dapat Saya gunakan dengan Django?</span></a> for\ndetails.</p>\n<p>Dapatkan versi terakhir dari Python pada <a class=\"reference external\" href=\"https://www.python.org/downloads/\">https://www.python.org/downloads/</a> atau dengan pengelola paket sistem operasi anda.</p>\n<aside class=\"admonition-python-on-windows admonition\">\n<p class=\"admonition-title\">Phyton di Windows</p>\n<p>Jika anda hanya memulai dengan Django dan menggunakan Windows, anda mungkin menemukan <a class=\"reference internal\" href=\"/id/6.0/howto/windows/\"><span class=\"doc\">Bagaimana memasang Django pada WIndows</span></a> berguna.</p>\n</aside>\n</section>\n<section id=\"install-apache-and-mod-wsgi\">\n<h2>Pasang Apache dan <code class=\"docutils literal notranslate\"><span class=\"pre\">mod_wsgi</span></code><a class=\"heading-anchor\" href=\"#install-apache-and-mod-wsgi\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>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.</p>\n<p>If you want to use Django on a production site, use <a class=\"reference external\" href=\"https://httpd.apache.org/\">Apache</a> with\n<a class=\"reference external\" href=\"https://modwsgi.readthedocs.io/en/develop/\">mod_wsgi</a>. mod_wsgi operates in one of two modes: embedded\nmode or daemon mode. In embedded mode, mod_wsgi is similar to\nmod_perl -- it embeds Python within Apache and loads Python code into\nmemory when the server starts. Code stays in memory throughout the\nlife of an Apache process, which leads to significant performance\ngains over other server arrangements. In daemon mode, mod_wsgi spawns\nan independent daemon process that handles requests. The daemon\nprocess can run as a different user than the web server, possibly\nleading to improved security. The daemon process can be restarted\nwithout restarting the entire Apache web server, possibly making\nrefreshing your codebase more seamless. Consult the mod_wsgi\ndocumentation to determine which mode is right for your setup. Make\nsure you have Apache installed with the mod_wsgi module activated.\nDjango will work with any version of Apache that supports mod_wsgi.</p>\n<p>Lihat <span class=\"xref std std-doc\">How to use Django with mod_wsgi 1</span> untuk informasi bagaimana mengkonfigurasi mode_wsgi sekali anda telah memasang itu.</p>\n<p>Jika anda tidak dapat menggunakan mod_wsgi untuk beberapa alasan, jangan takut: Django mendukung banyak pilihan penyebaran lain. Satu adalah <a class=\"reference internal\" href=\"/id/6.0/howto/deployment/wsgi/uwsgi/\"><span class=\"doc\">uWSGI</span></a>; itu bekerja sangat baik dengan <a class=\"reference external\" href=\"https://nginx.org/\">nginx</a>. Selain itu, Django mengikuti spesifikasi WSGI (<span class=\"target\" id=\"index-2\"></span><a class=\"pep reference external\" href=\"https://peps.python.org/pep-3333/\"><strong>PEP 3333</strong></a>), yang mengizinkannya untuk berjalan pada seragam serambi peladen.</p>\n</section>\n<section id=\"get-your-database-running\">\n<span id=\"database-installation\"></span><h2>Dapatkan basisdata anda berjalan<a class=\"heading-anchor\" href=\"#get-your-database-running\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>If you plan to use Django's database API functionality, you'll need to make\nsure a database server is running. Django supports many different database\nservers and is officially supported with <a class=\"reference external\" href=\"https://www.postgresql.org/\">PostgreSQL</a>, <a class=\"reference external\" href=\"https://mariadb.org/\">MariaDB</a>, <a class=\"reference external\" href=\"https://www.mysql.com/\">MySQL</a>, <a class=\"reference external\" href=\"https://www.oracle.com/\">Oracle</a>\nand <a class=\"reference external\" href=\"https://www.sqlite.org/\">SQLite</a>.</p>\n<p>If you are developing a small project or something you don't plan to deploy in\na production environment, SQLite is generally the best option as it doesn't\nrequire running a separate server. However, SQLite has many differences from\nother databases, so if you are working on something substantial, it's\nrecommended to develop with the same database that you plan on using in\nproduction.</p>\n<p>Sebagai tambahan ke basisdata didukung resmi, ada <span class=\"xref std std-ref\">backends provided by 3rd parties 1</span> yang mengizinkan anda menggunakan basisdata lain dengan Django.</p>\n<p>To use another database other than SQLite, you'll need to make sure that the\nappropriate Python database bindings are installed:</p>\n<ul class=\"simple\">\n<li><p>If you're using PostgreSQL, you'll need the <a class=\"reference external\" href=\"https://www.psycopg.org/psycopg3/\">psycopg</a> or <a class=\"reference external\" href=\"https://www.psycopg.org/\">psycopg2</a>\npackage. Refer to the <a class=\"reference internal\" href=\"/id/6.0/ref/databases/#postgresql-notes\"><span class=\"std std-ref\">PostgreSQL notes</span></a> for further\ndetails.</p></li>\n<li><p>If you're using MySQL or MariaDB, you'll need a <a class=\"reference internal\" href=\"/id/6.0/ref/databases/#mysql-db-api-drivers\"><span class=\"std std-ref\">DB API driver</span></a> like <code class=\"docutils literal notranslate\"><span class=\"pre\">mysqlclient</span></code>. See <a class=\"reference internal\" href=\"/id/6.0/ref/databases/#mysql-notes\"><span class=\"std std-ref\">notes for the MySQL\nbackend</span></a> for details.</p></li>\n<li><p>Jika anda sedang menggunakan SQLite anda mungkin ingin membaca <span class=\"xref std std-ref\">SQLite backend notes 1</span>.</p></li>\n<li><p>If you're using Oracle, you'll need to install <a class=\"reference external\" href=\"https://oracle.github.io/python-oracledb/\">oracledb</a>, but please read the\n<a class=\"reference internal\" href=\"/id/6.0/ref/databases/#oracle-notes\"><span class=\"std std-ref\">notes for the Oracle backend</span></a> for details regarding\nsupported versions of both Oracle and <code class=\"docutils literal notranslate\"><span class=\"pre\">oracledb</span></code>.</p></li>\n<li><p>Jika anda sedang menggunakan backend pihak ke3 tidak resmi, harap konsultasikan dokumentasi disediakan untuk persyaratan tambahan apapun.</p></li>\n</ul>\n<p>And ensure that the following keys in the <code class=\"docutils literal notranslate\"><span class=\"pre\">'default'</span></code> item of the\n<a class=\"reference internal\" href=\"/id/6.0/ref/settings/#std-setting-DATABASES\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">DATABASES</span></code></a> dictionary match your database connection settings:</p>\n<ul class=\"simple\">\n<li><p><a class=\"reference internal\" href=\"/id/6.0/ref/settings/#std-setting-DATABASE-ENGINE\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">ENGINE</span></code></a> -- Salah satu <code class=\"docutils literal notranslate\"><span class=\"pre\">'django.db.backends.sqlite3'</span></code>, <code class=\"docutils literal notranslate\"><span class=\"pre\">'django.db.backends.postgresql'</span></code>, <code class=\"docutils literal notranslate\"><span class=\"pre\">'django.db.backends.mysql'</span></code>, atau <code class=\"docutils literal notranslate\"><span class=\"pre\">'django.db.backends.oracle'</span></code>. Backend lainnya adalah <a class=\"reference internal\" href=\"/id/6.0/ref/databases/#third-party-notes\"><span class=\"std std-ref\">juga tersedia</span></a>.</p></li>\n<li><p><a class=\"reference internal\" href=\"/id/6.0/ref/settings/#std-setting-NAME\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">NAME</span></code></a> -- The name of your database. If you’re using SQLite, the\ndatabase will be a file on your computer. In that case, <code class=\"docutils literal notranslate\"><span class=\"pre\">NAME</span></code> should be\nthe full absolute path, including the filename of that file. You don’t need\nto create anything beforehand; the database file will be created\nautomatically when needed. The default value, <code class=\"docutils literal notranslate\"><span class=\"pre\">BASE_DIR</span> <span class=\"pre\">/</span> <span class=\"pre\">'db.sqlite3'</span></code>,\nwill store the file in your project directory.</p></li>\n</ul>\n<aside class=\"admonition-for-databases-other-than-sqlite admonition\">\n<p class=\"admonition-title\">Untuk basis data selain SQLite.</p>\n<p>Jika anda tidak menggunakan SQlite sebagai basisdata anda, pengaturan tambahan seperti <a class=\"reference internal\" href=\"/id/6.0/ref/settings/#std-setting-USER\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">USER</span></code></a>, <a class=\"reference internal\" href=\"/id/6.0/ref/settings/#std-setting-PASSWORD\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">PASSWORD</span></code></a>, dan <a class=\"reference internal\" href=\"/id/6.0/ref/settings/#std-setting-HOST\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">HOST</span></code></a> harus ditambahkan. Untuk lebih rinci, lihat acuan dukumentasi untuk <a class=\"reference internal\" href=\"/id/6.0/ref/settings/#std-setting-DATABASES\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">DATABASES</span></code></a>.</p>\n<p>Also, make sure that you've created the database by this point. Do that\nwith &quot;<code class=\"docutils literal notranslate\"><span class=\"pre\">CREATE</span> <span class=\"pre\">DATABASE</span> <span class=\"pre\">database_name;</span></code>&quot; within your database's\ninteractive prompt.</p>\n</aside>\n<p>Jika anda berencana untuk menggunakan perintah <code class=\"docutils literal notranslate\"><span class=\"pre\">manage.py</span> <span class=\"pre\">migrate</span></code> 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 <code class=\"docutils literal notranslate\"><span class=\"pre\">SELECT</span></code>, <code class=\"docutils literal notranslate\"><span class=\"pre\">INSERT</span></code>, <code class=\"docutils literal notranslate\"><span class=\"pre\">UPDATE</span></code> dan <code class=\"docutils literal notranslate\"><span class=\"pre\">DELETE</span></code>. Setelah membuat pengguna basis data dengan izin ini, anda akan menentukan rinciannya di berkas pengaturan proyek anda , lihat <a class=\"reference internal\" href=\"/id/6.0/ref/settings/#std-setting-DATABASES\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">DATABASES</span></code></a> untuk rinciannya.</p>\n<p>Jika anda sedang menggunakan <span class=\"xref std std-doc\">testing framework1</span> Django untuk mencoba permintaan basisdata, Django akan butuh perizinan untuk membuat basisdata percobaan.</p>\n</section>\n<section id=\"install-the-django-code\">\n<span id=\"install-django-code\"></span><h2>Pasang kode Django<a class=\"heading-anchor\" href=\"#install-the-django-code\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Installation instructions are slightly different depending on whether you're\ninstalling a distribution-specific package, downloading the latest official\nrelease, or fetching the latest development version.</p>\n<section id=\"installing-an-official-release-with-pip\">\n<span id=\"installing-official-release\"></span><h3>Memasang terbitan resmi dengan <code class=\"docutils literal notranslate\"><span class=\"pre\">pip</span></code><a class=\"heading-anchor\" href=\"#installing-an-official-release-with-pip\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Ini adalah cara yang dianjurkan untuk memasang Django.</p>\n<ol class=\"arabic\">\n<li><p>Pasang <a class=\"reference external\" href=\"https://pip.pypa.io/\">pip</a>. Paling mudah adalah menggunakan <a class=\"reference external\" href=\"https://pip.pypa.io/en/latest/installation/\">standalone pip installer</a>. Jika penyaluran anda sudah mempunyai <code class=\"docutils literal notranslate\"><span class=\"pre\">pip</span></code> terpasang, anda mungkin butuh memperbaharui jika itu sudah usang. Jika itu sudah usang, anda akan tahu karena pemasangan tidak akan bekerja.</p></li>\n<li><p>Take a look at <a class=\"reference external\" href=\"https://docs.python.org/3/tutorial/venv.html\" title=\"(di Python v3.14)\"><span class=\"xref std std-doc\">venv</span></a>. This tool provides\nisolated Python environments, which are more practical than installing\npackages systemwide. It also allows installing packages without\nadministrator privileges. The <a class=\"reference internal\" href=\"/id/6.0/intro/contributing/\"><span class=\"doc\">contributing tutorial</span></a> walks through how to create a virtual environment.</p></li>\n<li><p>After you've created and activated a virtual environment, enter the command:</p>\n<div class=\"console\" data-console><div class=\"console-panel\" data-platform=\"unix\"><p class=\"console-label\" id=\"console-0-unix-label\">Linux / macOS</p><div class=\"code-block\" data-language=\"console\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Shell</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=\"Shell code\"><code><span class=\"gp\">$ </span>python<span class=\"w\"> </span>-m<span class=\"w\"> </span>pip<span class=\"w\"> </span>install<span class=\"w\"> </span>Django\n</code></pre></div>\n</div><div class=\"console-panel\" data-platform=\"windows\"><p class=\"console-label\" id=\"console-0-windows-label\">Windows</p><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 shell\"><code><span class=\"gp\">...\\&gt;</span> py -m pip install Django\n</code></pre></div></div></div>\n</li>\n</ol>\n</section>\n<section id=\"installing-a-distribution-specific-package\">\n<span id=\"installing-distribution-package\"></span><h3>Memasang paket penyebaran-tertentu<a class=\"heading-anchor\" href=\"#installing-a-distribution-specific-package\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Check the <a class=\"reference internal\" href=\"/id/6.0/misc/distributions/\"><span class=\"doc\">distribution specific notes</span></a> to see if\nyour platform/distribution provides official Django packages/installers.\nDistribution-provided packages will typically allow for automatic installation\nof dependencies and supported upgrade paths; however, these packages will\nrarely contain the latest release of Django.</p>\n</section>\n<section id=\"installing-the-development-version\">\n<span id=\"installing-development-version\"></span><h3>Memasang versi pengembangan<a class=\"heading-anchor\" href=\"#installing-the-development-version\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<aside class=\"admonition-tracking-django-development admonition\">\n<p class=\"admonition-title\">Melacak pengembangan Django</p>\n<p>If you decide to use the latest development version of Django,\nyou'll want to pay close attention to <a class=\"reference external\" href=\"https://code.djangoproject.com/timeline\">the development timeline</a>,\nand you'll want to keep an eye on the <a class=\"reference internal\" href=\"/id/6.0/releases/#development-release-notes\"><span class=\"std std-ref\">release notes for the\nupcoming release</span></a>. This will help you stay\non top of any new features you might want to use, as well as any changes\nyou'll need to make to your code when updating your copy of Django.\n(For stable releases, any necessary changes are documented in the\nrelease notes.)</p>\n</aside>\n<p>If you'd like to be able to update your Django code occasionally with the\nlatest bug fixes and improvements, follow these instructions:</p>\n<ol class=\"arabic\">\n<li><p>Pastikan anda mempunyai <a class=\"reference external\" href=\"https://git-scm.com/\">Git</a> terpasang dan anda dapat menjalankan perintah nya dari shell. (masukkan <code class=\"docutils literal notranslate\"><span class=\"pre\">git</span> <span class=\"pre\">help</span></code> pada shell prompt untuk mencoba ini.)</p></li>\n<li><p>Periksa cabang pengembangan Django seperti itu:</p>\n<div class=\"console\" data-console><div class=\"console-panel\" data-platform=\"unix\"><p class=\"console-label\" id=\"console-1-unix-label\">Linux / macOS</p><div class=\"code-block\" data-language=\"console\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Shell</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=\"Shell code\"><code><span class=\"gp\">$ </span>git<span class=\"w\"> </span>clone<span class=\"w\"> </span>https://github.com/django/django.git\n</code></pre></div>\n</div><div class=\"console-panel\" data-platform=\"windows\"><p class=\"console-label\" id=\"console-1-windows-label\">Windows</p><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 shell\"><code><span class=\"gp\">...\\&gt;</span> git clone https://github.com/django/django.git\n</code></pre></div></div></div>\n<p>Ini akan membuat sebuah direktori <code class=\"docutils literal notranslate\"><span class=\"pre\">django</span></code> dalam direktori anda saat ini.</p>\n</li>\n<li><p>Make sure that the Python interpreter can load Django's code. The most\nconvenient way to do this is to use a virtual environment and <a class=\"reference external\" href=\"https://pip.pypa.io/\">pip</a>. The\n<a class=\"reference internal\" href=\"/id/6.0/intro/contributing/\"><span class=\"doc\">contributing tutorial</span></a> walks through how to\ncreate a virtual environment.</p></li>\n<li><p>After setting up and activating the virtual environment, run the following\ncommand:</p>\n<div class=\"console\" data-console><div class=\"console-panel\" data-platform=\"unix\"><p class=\"console-label\" id=\"console-2-unix-label\">Linux / macOS</p><div class=\"code-block\" data-language=\"console\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Shell</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=\"Shell code\"><code><span class=\"gp\">$ </span>python<span class=\"w\"> </span>-m<span class=\"w\"> </span>pip<span class=\"w\"> </span>install<span class=\"w\"> </span>-e<span class=\"w\"> </span>django/\n</code></pre></div>\n</div><div class=\"console-panel\" data-platform=\"windows\"><p class=\"console-label\" id=\"console-2-windows-label\">Windows</p><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 shell\"><code><span class=\"gp\">...\\&gt;</span> py -m pip install -e django\\\n</code></pre></div></div></div>\n<p>This will make Django's code importable, and will also make the\n<code class=\"docutils literal notranslate\"><span class=\"pre\">django-admin</span></code> utility command available. In other words, you're all\nset!</p>\n</li>\n</ol>\n<p>When you want to update your copy of the Django source code, run the command\n<code class=\"docutils literal notranslate\"><span class=\"pre\">git</span> <span class=\"pre\">pull</span></code> from within the <code class=\"docutils literal notranslate\"><span class=\"pre\">django</span></code> directory. When you do this, Git will\ndownload any changes.</p>\n</section>\n</section>","rootId":"how-to-install-django","toc":[{"title":"Pasang Phyton","anchor":"install-python","children":[]},{"title":"Pasang Apache dan mod_wsgi","anchor":"install-apache-and-mod-wsgi","children":[]},{"title":"Dapatkan basisdata anda berjalan","anchor":"get-your-database-running","children":[]},{"title":"Pasang kode Django","anchor":"install-the-django-code","children":[{"title":"Memasang terbitan resmi dengan pip","anchor":"installing-an-official-release-with-pip","children":[]},{"title":"Memasang paket penyebaran-tertentu","anchor":"installing-a-distribution-specific-package","children":[]},{"title":"Memasang versi pengembangan","anchor":"installing-the-development-version","children":[]}]}],"breadcrumbs":[{"docname":"topics/index","title":"Menggunakan Django","url":"/id/6.0/topics/"}],"prev":{"docname":"topics/index","title":"Menggunakan Django","url":"/id/6.0/topics/"},"next":{"docname":"topics/db/index","title":"Model dan basisdata","url":"/id/6.0/topics/db/"},"formats":{"html":"/id/6.0/topics/install/","markdown":"/id/6.0/topics/install.md","json":"/id/6.0/topics/install.json"},"source":"https://github.com/django/django/blob/stable/6.0.x/docs/topics/install.txt","official":"https://docs.djangoproject.com/id/6.0/topics/install/","inVersions":["6.1","6.0","5.2","5.1","5.0","4.2","4.1","4.0","3.2","3.1","3.0","2.2","2.1","2.0","1.11","1.10","1.9"],"inLocales":["en","sv","zh-hans","ga","fr","ja","id","it","pt-br","ko","es","el","pl"]}