{"title":"Scríobh do chéad aip Django, cuid 1","version":"6.1","locale":"ga","docname":"intro/tutorial01","url":"/ga/6.1/intro/tutorial01/","canonical":"https://djangodocs.dev/ga/6.1/intro/tutorial01/","summary":"Foghlaimímis trí shampla. Le linn an teagaisc seo, beimid ag siúl leat trí bhunfheidhmchlár vótaíochta a chruthú.","html":"<h1>Scríobh do chéad aip Django, cuid 1<a class=\"heading-anchor\" href=\"#writing-your-first-django-app-part-1\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p>Foghlaimímis trí shampla.</p>\n<p>Le linn an teagaisc seo, beimid ag siúl leat trí bhunfheidhmchlár vótaíochta a chruthú.</p>\n<p>Beidh dhá chuid ann:</p>\n<ul class=\"simple\">\n<li><p>Suíomh poiblí a ligeann do dhaoine féachaint ar na pobalbhreitheanna agus vótáil iontu.</p></li>\n<li><p>Suíomh riaracháin a ligeann duit pobalbhreitheanna a chur leis, a athrú agus a scriosadh.</p></li>\n</ul>\n<p>Glacfaimid leis go bhfuil :d oc: Django suiteáilte &lt;/intro/install&gt; agat cheana féin. Is féidir leat a rá go bhfuil Django suiteáilte agus cén leagan tríd an ordú seo a leanas a rith i leid bhlaosc (arna léiriú ag an réimír $):</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 -m django --version\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 django --version\n</code></pre></div></div></div>\n<p>Má tá Django suiteáilte, ba chóir duit an leagan de do shuiteáil a fheiceáil. Mura bhfuil, gheobhaidh tú earráid ag insint &quot;Níl modúl darb ainm django&quot;.</p>\n<p>This tutorial is written for Django 6.1, which supports Python 3.12 and\nlater. If the Django version doesn't match, you can refer to the tutorial for\nyour version of Django by using the version switcher at the bottom right corner\nof this page, or update Django to the newest version. If you're using an older\nversion of Python, check <a class=\"reference internal\" href=\"/ga/6.1/faq/install/#faq-python-version-support\"><span class=\"std std-ref\">Cén leagan Python is féidir liom a úsáid le Django?</span></a> to find a compatible\nversion of Django.</p>\n<aside class=\"admonition-where-to-get-help admonition\" role=\"note\">\n<p class=\"admonition-title\">Cá háit le cabhair a fháil:</p>\n<p>Má tá deacracht agat dul tríd an rang teagaisc seo, téigh ar aghaidh chuig an rannán :d oc:'Getting Help&lt;/faq/help&gt;' den rannán Ceisteanna Coitianta.</p>\n</aside>\n<section id=\"creating-a-project\">\n<h2>Tionscadal a chruthú<a class=\"heading-anchor\" href=\"#creating-a-project\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Más é seo do chéad uair ag baint úsáide as Django, beidh ort aire a thabhairt do roinnt thus tosaigh. Eadhon, beidh ort roinnt cód a ghiniúint go huathoibríoch a bhunaíonn Django: téarma: 'tionscadal' - bailiúchán socruithe le haghaidh sampla de Django, lena n-áirítear cumraíocht bunachar sonraí, roghanna Django-sonrach agus socruithe a bhaineann go sonrach le feidhmchlár.</p>\n<p>From the command line, <code class=\"docutils literal notranslate\">cd</code> into a directory where you'd like to store your\ncode and run the following command to bootstrap a new Django project:</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>django-admin startproject mysite djangotutorial\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> django-admin startproject mysite djangotutorial\n</code></pre></div></div></div>\n<p>This will create a directory <code class=\"docutils literal notranslate\">djangotutorial</code> with a project called\n<code class=\"docutils literal notranslate\">mysite</code> inside. The directory name doesn't matter to Django; you can rename\nit to anything you like. If it didn't work, see\n<a class=\"reference internal\" href=\"/ga/6.1/faq/troubleshooting/#troubleshooting-django-admin\"><span class=\"std std-ref\">Fadhbanna ag rith ''django-admin''</span></a>.</p>\n<aside class=\"admonition admonition-note\" role=\"note\">\n<p class=\"admonition-title\">Note</p>\n<p>Beidh ort tionscadail a ainmniú tar éis comhpháirteanna Python nó Django tógtha isteach. Go háirithe, ciallaíonn sé seo gur chóir duit ainmneacha mar <code class=\"docutils literal notranslate\">django</code> (a thiocfaidh salach ar Django féin) nó <code class=\"docutils literal notranslate\">test</code> (a thagann salach ar phacáiste Python ionsuite) a sheachaint.</p>\n</aside>\n<p>Breathnaímis ar an méid a chruthaigh :d jadmin:'startproject':</p>\n<div class=\"code-block\" data-language=\"text\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Text</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=\"Text code\"><code>djangotutorial/\n    manage.py\n    mysite/\n        __init__.py\n        settings.py\n        urls.py\n        asgi.py\n        wsgi.py\n</code></pre></div>\n<p>Is iad seo a leanas na comhaid seo:</p>\n<ul class=\"simple\">\n<li><p><code class=\"file docutils literal notranslate\">manage.py</code>: A command-line utility that lets you interact with this\nDjango project in various ways. You can read all the details about\n<code class=\"file docutils literal notranslate\">manage.py</code> in <a class=\"reference internal\" href=\"/ga/6.1/ref/django-admin/\"><span class=\"doc\">django-admin agus manage.py</span></a>.</p></li>\n<li><p><a href=\"#id1\"><span class=\"problematic\" id=\"id2\">:comhad:`mysite/`</span></a>: Eolaire arb é an pacáiste Python iarbhír do do thionscadal. Is é an t-ainm an t-ainm pacáiste Python a chaithfidh tú a úsáid chun aon rud a allmhairiú laistigh de (m.sh. <code class=\"docutils literal notranslate\">mysite.urls</code>).</p></li>\n<li><p><code class=\"file docutils literal notranslate\">mysite/__init__.py</code>: Comhad folamh a insíonn do Python gur chóir an t-eolaire seo a mheas mar phacáiste Python. Más tosaitheoir Python tú, léigh :ref:'more about packages&lt;tut-packages&gt;' sna docs oifigiúla Python.</p></li>\n<li><p><code class=\"file docutils literal notranslate\">mysite/settings.py</code>: Settings/configuration for this Django\nproject. <a class=\"reference internal\" href=\"/ga/6.1/topics/settings/\"><span class=\"doc\">Django settings</span></a> will tell you all about how settings\nwork.</p></li>\n<li><p><code class=\"file docutils literal notranslate\">mysite/urls.py</code>: The URL declarations for this Django project; a\n&quot;table of contents&quot; of your Django-powered site. You can read more about\nURLs in <a class=\"reference internal\" href=\"/ga/6.1/topics/http/urls/\"><span class=\"doc\">URL dispatcher</span></a>.</p></li>\n<li><p><code class=\"file docutils literal notranslate\">mysite/asgi.py</code>: Pointe iontrála do fhreastalaithe gréasáin atá comhoiriúnach le ASGI chun freastal ar do thionscadal. Féach :d oc:/howto/deployment/asgi/index le haghaidh tuilleadh sonraí.</p></li>\n<li><p><code class=\"file docutils literal notranslate\">mysite/wsgi.py</code>: : Pointe iontrála le haghaidh freastalaithe gréasáin atá comhoiriúnach le WSGI chun freastal ar do thionscadal. Féach <a class=\"reference internal\" href=\"/ga/6.1/howto/deployment/wsgi/\"><span class=\"doc\">Conas a imscaradh le WSGI</span></a> le haghaidh tuilleadh sonraí.</p></li>\n</ul>\n</section>\n<section id=\"the-development-server\">\n<h2>An freastalaí forbartha<a class=\"heading-anchor\" href=\"#the-development-server\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>A ligean ar fhíorú do oibreacha tionscadal Django. Athraigh isteach sa chomhad:djangotutorial eolaire, mura bhfuil tú cheana féin, agus rith na horduithe seo a leanas:</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 manage.py runserver\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 manage.py runserver\n</code></pre></div></div></div>\n<p>Feicfidh tú an t-aschur seo a leanas ar an líne ordaithe:</p>\n<pre class=\"literal-block\">Performing system checks...\n\nSystem check identified no issues (0 silenced).\n\nYou have unapplied migrations; your app may not work properly until they are\napplied. Run 'python manage.py migrate' to apply them.\n\nDFómh 03, 2026 - 15:50:53\nDjango version 6.1, using settings 'mysite.settings'\nStarting development server at <a class=\"reference external\" href=\"http://127.0.0.1:8000/\">http://127.0.0.1:8000/</a>\nQuit the server with CONTROL-C.\n\nWARNING: This is a development server. Do not use it in a production setting. Use a production WSGI or ASGI server instead.\nFor more information on production servers see: <a class=\"reference external\" href=\"https://docs.djangoproject.com/en/\">https://docs.djangoproject.com/en/</a>6.1/howto/deployment/</pre>\n<aside class=\"admonition admonition-note\" role=\"note\">\n<p class=\"admonition-title\">Note</p>\n<p>Déan neamhaird den rabhadh faoi imirce bunachar sonraí neamhfheidhmithe anois; Déileálfaimid leis an mbunachar sonraí go luath.</p>\n</aside>\n<p>Anois go bhfuil an freastalaí ag rith, tabhair cuairt <a class=\"reference external\" href=\"http://127.0.0.1:8000/\">http://127.0.0.1:8000/</a> le do bhrabhsálaí gréasáin. Feicfidh tú &quot;Comhghairdeas!&quot; leathanach, le roicéad ag éirí as. D'oibrigh sé!</p>\n<p>Thosaigh tú an freastalaí forbartha Django, freastalaí gréasáin éadrom scríofa i Python amháin. Táimid tar éis é seo a chur san áireamh le Django ionas gur féidir leat rudaí a fhorbairt go tapa, gan déileáil le freastalaí táirgeachta a chumrú - mar shampla Apache - go dtí go mbeidh tú réidh le táirgeadh.</p>\n<p>Is dea-am é anois le tabhairt faoi deara: <strong>ná</strong> úsáid an freastalaí seo in aon rud atá cosúil le timpeallacht táirgthe. Níl sé beartaithe ach le húsáid agus é ag forbairt. (Táimid i mbun creataí gréasáin a dhéanamh, ní freastalaithe gréasáin.)</p>\n<p>(Chun freastal ar an suíomh ar phort eile, féach an tagairt :d jadmin:runserver.)</p>\n<aside class=\"admonition-automatic-reloading-of-djadmin-runserver admonition\" role=\"note\">\n<p class=\"admonition-title\">Athluchtú uathoibríoch :d jadmin: 'runserver'</p>\n<p>Athluchtaíonn an freastalaí forbartha cód Python go huathoibríoch do gach iarratas de réir mar is gá. Ní gá duit an freastalaí a atosú chun athruithe cóid a chur i bhfeidhm. Mar sin féin, ní spreagann roinnt gníomhartha cosúil le comhaid a chur leis atosú, mar sin beidh ort an freastalaí a atosú sna cásanna seo.</p>\n</aside>\n</section>\n<section id=\"creating-the-polls-app\">\n<h2>Cruthú an aip vótaíochta<a class=\"heading-anchor\" href=\"#creating-the-polls-app\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Anois go bhfuil do thimpeallacht -- &quot;tionscadal&quot; -- ar bun, tá tú ar tí tosú ag déanamh oibre.</p>\n<p>Is éard atá i ngach feidhmchlár a scríobhann tú i Django pacáiste Python a leanann coinbhinsiún áirithe. Tagann Django le fóntais a ghineann struchtúr bunúsach eolaire app go huathoibríoch, ionas gur féidir leat díriú ar chód scríbhneoireachta seachas eolairí a chruthú.</p>\n<aside class=\"admonition-projects-vs-apps admonition\" role=\"note\">\n<p class=\"admonition-title\">Tionscadail vs apps</p>\n<p>Cad é an difríocht idir tionscadal agus aip? Is feidhmchlár gréasáin é aip a dhéanann rud éigin -- m.sh., córas blag, bunachar sonraí de thaifid phoiblí nó aip bheag vótaíochta. Is éard is tionscadal ann ná bailiúchán cumraíochta agus feidhmchlár do shuíomh gréasáin ar leith. Is féidir aipeanna éagsúla a bheith i dtionscadal. Is féidir le app a bheith i dtionscadail éagsúla.</p>\n</aside>\n<p>Is féidir le d’aipeanna maireachtáil áit ar bith i do <a class=\"reference external\" href=\"https://docs.python.org/3/tutorial/modules.html#tut-searchpath\" title=\"(in Python v3.14)\"><span class=\"xref std std-ref\">Python path</span></a>. Sa rang teagaisc seo, cruthóimid ár n-aip vótaíochta laistigh den fhillteán <code class=\"docutils literal notranslate\">djangotutorial</code>.</p>\n<p>Chun d'aip a chruthú, cinntigh go bhfuil tú san eolaire céanna le <code class=\"file docutils literal notranslate\">manage.py</code> agus clóscríobh an t-ordú seo:</p>\n<div class=\"console\" data-console><div class=\"console-panel\" data-platform=\"unix\"><p class=\"console-label\" id=\"console-3-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 manage.py startapp polls\n</code></pre></div>\n</div><div class=\"console-panel\" data-platform=\"windows\"><p class=\"console-label\" id=\"console-3-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 manage.py startapp polls\n</code></pre></div></div></div>\n<p>Cruthóidh sé sin eolaire <code class=\"file docutils literal notranslate\">polls</code>, atá leagtha amach mar seo:</p>\n<div class=\"code-block\" data-language=\"text\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Text</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=\"Text code\"><code>polls/\n    __init__.py\n    admin.py\n    apps.py\n    migrations/\n        __init__.py\n    models.py\n    tests.py\n    views.py\n</code></pre></div>\n<p>Beidh an feidhmchlár vótaíochta sa struchtúr eolaire seo.</p>\n</section>\n<section id=\"write-your-first-view\">\n<h2>Scríobh do chéad amharc<a class=\"heading-anchor\" href=\"#write-your-first-view\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Scríobhaimis an chéad amharc. Oscail an comhad <code class=\"docutils literal notranslate\">polls/views.py</code> agus cuir an cód Python seo a leanas ann:</p>\n<figure class=\"code-block code-block-captioned\" data-language=\"python\"><figcaption class=\"code-block-caption\"><code class=\"docutils literal notranslate\">polls/views.py</code></figcaption>\n<div class=\"code-block-toolbar\"><span class=\"code-block-language\">Python</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=\"Python code\"><code><span class=\"kn\">from</span> <span class=\"nn\">django.http</span> <span class=\"kn\">import</span> HttpResponse\n\n\n<span class=\"k\">def</span> <span class=\"nf\">index</span><span class=\"p\">(</span>request<span class=\"p\">):</span>\n    <span class=\"k\">return</span> HttpResponse<span class=\"p\">(</span><span class=\"s2\">&quot;Hello, world. You&#39;re at the polls index.&quot;</span><span class=\"p\">)</span>\n</code></pre></figure>\n<p>Is é seo an dearcadh is bunúsaí is féidir i Django. Chun rochtain a fháil air i mbrabhsálaí, ní mór dúinn é a mhapáil chuig URL - agus chuige seo ní mór dúinn cumraíocht URL, nó &quot;URLconf&quot; a shainiú go gairid. Sainmhínítear na cumraíochtaí URL seo taobh istigh de gach feidhmchlár Django, agus is comhaid Python iad darb ainm <code class=\"docutils literal notranslate\">urls.py</code>.</p>\n<p>Chun URLconf a shainmhíniú don aip <code class=\"docutils literal notranslate\">polls</code>, cruthaigh comhad <code class=\"docutils literal notranslate\">polls/urls.py</code> leis an ábhar seo a leanas:</p>\n<figure class=\"code-block code-block-captioned\" data-language=\"python\"><figcaption class=\"code-block-caption\"><code class=\"docutils literal notranslate\">polls/urls.py</code></figcaption>\n<div class=\"code-block-toolbar\"><span class=\"code-block-language\">Python</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=\"Python code\"><code><span class=\"kn\">from</span> <span class=\"nn\">django.urls</span> <span class=\"kn\">import</span> path\n\n<span class=\"kn\">from</span> <span class=\"nn\">.</span> <span class=\"kn\">import</span> views\n\nurlpatterns <span class=\"o\">=</span> <span class=\"p\">[</span>\n    path<span class=\"p\">(</span><span class=\"s2\">&quot;&quot;</span><span class=\"p\">,</span> views<span class=\"o\">.</span>index<span class=\"p\">,</span> name<span class=\"o\">=</span><span class=\"s2\">&quot;index&quot;</span><span class=\"p\">),</span>\n<span class=\"p\">]</span>\n</code></pre></figure>\n<p>Ba cheart go mbeadh cuma ar do eolaire feidhmchlár anois:</p>\n<div class=\"code-block\" data-language=\"text\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Text</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=\"Text code\"><code>polls/\n    __init__.py\n    admin.py\n    apps.py\n    migrations/\n        __init__.py\n    models.py\n    tests.py\n    urls.py\n    views.py\n</code></pre></div>\n<p>The next step is to configure the root URLconf in the <code class=\"docutils literal notranslate\">mysite</code> project to\ninclude the URLconf defined in <code class=\"docutils literal notranslate\">polls.urls</code>. To do this, add an import for\n<code class=\"docutils literal notranslate\">django.urls.include</code> in <code class=\"docutils literal notranslate\">mysite/urls.py</code> and insert an\n<a class=\"reference internal\" href=\"/ga/6.1/ref/urls/#django.urls.include\" title=\"django.urls.include\"><code class=\"xref py py-func docutils literal notranslate\">include()</code></a> in the <code class=\"docutils literal notranslate\">urlpatterns</code> list, so you have:</p>\n<figure class=\"code-block code-block-captioned\" data-language=\"python\"><figcaption class=\"code-block-caption\"><code class=\"docutils literal notranslate\">mysite/urls.py</code></figcaption>\n<div class=\"code-block-toolbar\"><span class=\"code-block-language\">Python</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=\"Python code\"><code><span class=\"kn\">from</span> <span class=\"nn\">django.contrib</span> <span class=\"kn\">import</span> admin\n<span class=\"kn\">from</span> <span class=\"nn\">django.urls</span> <span class=\"kn\">import</span> include<span class=\"p\">,</span> path\n\nurlpatterns <span class=\"o\">=</span> <span class=\"p\">[</span>\n    path<span class=\"p\">(</span><span class=\"s2\">&quot;polls/&quot;</span><span class=\"p\">,</span> include<span class=\"p\">(</span><span class=\"s2\">&quot;polls.urls&quot;</span><span class=\"p\">)),</span>\n    path<span class=\"p\">(</span><span class=\"s2\">&quot;admin/&quot;</span><span class=\"p\">,</span> admin<span class=\"o\">.</span>site<span class=\"o\">.</span>urls<span class=\"p\">),</span>\n<span class=\"p\">]</span>\n</code></pre></figure>\n<p>The <a class=\"reference internal\" href=\"/ga/6.1/ref/urls/#django.urls.path\" title=\"django.urls.path\"><code class=\"xref py py-func docutils literal notranslate\">path()</code></a> function expects at least two arguments:\n<code class=\"docutils literal notranslate\">route</code> and <code class=\"docutils literal notranslate\">view</code>.\nThe <a class=\"reference internal\" href=\"/ga/6.1/ref/urls/#django.urls.include\" title=\"django.urls.include\"><code class=\"xref py py-func docutils literal notranslate\">include()</code></a> function allows referencing other URLconfs.\nWhenever Django encounters <a class=\"reference internal\" href=\"/ga/6.1/ref/urls/#django.urls.include\" title=\"django.urls.include\"><code class=\"xref py py-func docutils literal notranslate\">include()</code></a>, it chops off whatever\npart of the URL matched up to that point and sends the remaining string to the\nincluded URLconf for further processing.</p>\n<p>Is é an smaoineamh taobh thiar de <a class=\"reference internal\" href=\"/ga/6.1/ref/urls/#django.urls.include\" title=\"django.urls.include\"><code class=\"xref py py-func docutils literal notranslate\">include()</code></a> é a dhéanamh éasca URLanna plug-and-play. Ós rud é go bhfuil pobalbhreith ina URLconf féin (`` pobalbhreith/urls.py``), is féidir iad a chur faoi &quot;/polls/&quot;, nó faoi &quot;/fun_polls/&quot;, nó faoi &quot;/content/polls/&quot;, nó aon fréimhe cosán eile, agus beidh an app fós ag obair.</p>\n<aside class=\"admonition-when-to-use-func-django-urls-include admonition\" role=\"note\">\n<p class=\"admonition-title\">When to use <a class=\"reference internal\" href=\"/ga/6.1/ref/urls/#django.urls.include\" title=\"django.urls.include\"><code class=\"xref py py-func docutils literal notranslate\">include()</code></a></p>\n<p>Ba chóir duit <code class=\"docutils literal notranslate\">include()</code> a úsáid i gcónaí nuair a chuireann tú patrúin URL eile san áireamh. Is é an t-aon eisceacht ná <code class=\"docutils literal notranslate\">admin.site.urls</code>, ar URLconf réamhthógtha é a sholáthraíonn Django don suíomh riaracháin réamhshocraithe.</p>\n</aside>\n<p>Tá amharc <code class=\"docutils literal notranslate\">index</code> sreangaithe agat anois sa URLconf. Fíoraigh go bhfuil sé ag obair leis an ordú seo a leanas:</p>\n<div class=\"console\" data-console><div class=\"console-panel\" data-platform=\"unix\"><p class=\"console-label\" id=\"console-4-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 manage.py runserver\n</code></pre></div>\n</div><div class=\"console-panel\" data-platform=\"windows\"><p class=\"console-label\" id=\"console-4-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 manage.py runserver\n</code></pre></div></div></div>\n<p>Téigh go <a class=\"reference external\" href=\"http://localhost:8000/polls/\">http://localhost:8000/polls/</a> i do bhrabhsálaí, agus ba cheart duit an téacs &quot;<em>Dia duit, world. Tá tú ag an innéacs pobalbhreithe.</em>&quot; a fheiceáil, a shainigh tú sa radharc <code class=\"docutils literal notranslate\">innéacs</code> .</p>\n<aside class=\"admonition-page-not-found admonition\" role=\"note\">\n<p class=\"admonition-title\">Ní bhfuarthas an leathanach?</p>\n<p>Má fhaigheann tú leathanach earráide anseo, seiceáil go bhfuil tú ag dul chuig <a class=\"reference external\" href=\"http://localhost:8000/polls/\">http://localhost:8000/polls/</a> agus ní <a class=\"reference external\" href=\"http://localhost:8000/\">http://localhost:8000/</a>.</p>\n</aside>\n<p>Nuair atá tú compordach leis an mbunsreabhadh iarratais agus freagartha, léigh <a class=\"reference internal\" href=\"/ga/6.1/intro/tutorial02/\"><span class=\"doc\">cuid 2 den rang teagaisc seo</span></a> chun tosú ag obair leis an mbunachar sonraí.</p>\n</section>","rootId":"writing-your-first-django-app-part-1","toc":[{"title":"Tionscadal a chruthú","anchor":"creating-a-project","children":[]},{"title":"An freastalaí forbartha","anchor":"the-development-server","children":[]},{"title":"Cruthú an aip vótaíochta","anchor":"creating-the-polls-app","children":[]},{"title":"Scríobh do chéad amharc","anchor":"write-your-first-view","children":[]}],"breadcrumbs":[{"docname":"intro/index","title":"Ag tosnú","url":"/ga/6.1/intro/"}],"prev":{"docname":"intro/install","title":"Treoir suiteála tapa","url":"/ga/6.1/intro/install/"},"next":{"docname":"intro/tutorial02","title":"Scríobh do chéad aip Django, cuid 2","url":"/ga/6.1/intro/tutorial02/"},"formats":{"html":"/ga/6.1/intro/tutorial01/","markdown":"/ga/6.1/intro/tutorial01.md","json":"/ga/6.1/intro/tutorial01.json"},"source":"https://github.com/django/django/blob/stable/6.1.x/docs/intro/tutorial01.txt","official":"https://docs.djangoproject.com/ga/6.1/intro/tutorial01/","inVersions":["6.1","6.0","5.2"],"inLocales":["en","sv","zh-hans","ga","fr","ja","id","it","pt-br","ko","es","el","pl"]}